geom_pie()
¶Two new parameters have been added to the geom_pie()
function:
direction
: Controls the sector layout, allowing it to be drawn either clockwise or counterclockwise.start
: Specifies the starting angle of the pie chart in degrees.from lets_plot import *
LetsPlot.setup_html()
data = {
'name': ['a', 'b', 'c', 'd', 'b'],
'value': [ 40, 90, 10 , 50, 20]}
p = ggplot(data, aes(fill='name', weight='value'))
By default, the first sector is positioned counterclockwise from the start point (12 o’clock), while the remaining sectors are arranged clockwise.
p + geom_pie(size=.6, size_unit='x') + ggtitle('geom_pie()')
direction
¶Use 1
for clockwise (default) or -1
for counterclockwise.
p + geom_pie(size=.6, size_unit='x', direction=-1) + ggtitle('geom_pie(direction=-1)')
start
¶Defines the initial angle in degrees. Setting start = 0
disables the default layout.
gggrid([
p + geom_pie(size=.9, size_unit='x') + ggtitle('Default'),
p + geom_pie(size=.9, size_unit='x', start=0) + ggtitle('start=0'),
p + geom_pie(size=.9, size_unit='x', start=180) + ggtitle('start=180')
])