@@ -2469,7 +2469,7 @@ def stem(self, *args, **kwargs):
2469
2469
return stem_container
2470
2470
2471
2471
@_preprocess_data (replace_names = ['x' , 'explode' , 'labels' , 'colors' ],
2472
- label_namer = None )
2472
+ label_namer = None )
2473
2473
def pie (self , x , explode = None , labels = None , colors = None ,
2474
2474
autopct = None , pctdistance = 0.6 , shadow = False , labeldistance = 1.1 ,
2475
2475
startangle = None , radius = None , counterclock = True ,
@@ -2479,95 +2479,98 @@ def pie(self, x, explode=None, labels=None, colors=None,
2479
2479
Plot a pie chart.
2480
2480
2481
2481
Make a pie chart of array *x*. The fractional area of each
2482
- wedge is given by x/sum(x). If sum(x) <= 1, then the values
2483
- of x give the fractional area directly and the array will not
2484
- be normalized. The wedges are plotted counterclockwise,
2485
- by default starting from the x-axis.
2482
+ wedge is given by `` x/sum(x)`` . If `` sum(x) <= 1`` , then the
2483
+ values of x give the fractional area directly and the array
2484
+ will not be normalized. The wedges are plotted
2485
+ counterclockwise, by default starting from the x-axis.
2486
2486
2487
- Keyword arguments:
2487
+ Parameters
2488
+ ----------
2489
+ x : array-like
2490
+ The input array used to make the pie chart.
2488
2491
2489
- * explode*: [ *None* | len(x) sequence ]
2492
+ explode : array-like, optional, default: None
2490
2493
If not *None*, is a ``len(x)`` array which specifies the
2491
2494
fraction of the radius with which to offset each wedge.
2492
2495
2493
- *colors*: [ *None* | color sequence ]
2496
+ labels : list, optional, default: None
2497
+ A sequence of strings providing the labels for each wedge
2498
+
2499
+ colors : array-like, optional, default: None
2494
2500
A sequence of matplotlib color args through which the pie chart
2495
2501
will cycle. If `None`, will use the colors in the currently
2496
2502
active cycle.
2497
2503
2498
- *labels*: [ *None* | len(x) sequence of strings ]
2499
- A sequence of strings providing the labels for each wedge
2500
-
2501
- *autopct*: [ *None* | format string | format function ]
2504
+ autopct : None (default), string, or function, optional
2502
2505
If not *None*, is a string or function used to label the wedges
2503
2506
with their numeric value. The label will be placed inside the
2504
2507
wedge. If it is a format string, the label will be ``fmt%pct``.
2505
2508
If it is a function, it will be called.
2506
2509
2507
- *pctdistance*: scalar
2510
+ pctdistance : float, optional, default: 0.6
2508
2511
The ratio between the center of each pie slice and the
2509
2512
start of the text generated by *autopct*. Ignored if
2510
- *autopct* is *None*; default is 0.6 .
2513
+ *autopct* is *None*.
2511
2514
2512
- *labeldistance*: scalar
2513
- The radial distance at which the pie labels are drawn
2514
-
2515
- *shadow*: [ *False* | *True* ]
2515
+ shadow : bool, optional, default: False
2516
2516
Draw a shadow beneath the pie.
2517
2517
2518
- *startangle*: [ *None* | Offset angle ]
2518
+ labeldistance : float, optional, default: 1.1
2519
+ The radial distance at which the pie labels are drawn
2520
+
2521
+ startangle : float, optional, default: None
2519
2522
If not *None*, rotates the start of the pie chart by *angle*
2520
2523
degrees counterclockwise from the x-axis.
2521
2524
2522
- * radius*: [ *None* | scalar ]
2523
- The radius of the pie, if *radius* is *None* it will be set to 1.
2525
+ radius : float, optional, default: None
2526
+ The radius of the pie, if *radius* is *None* it will be set to 1.
2524
2527
2525
- * counterclock*: [ *False* | * True* ]
2528
+ counterclock : bool, optional, default: True
2526
2529
Specify fractions direction, clockwise or counterclockwise.
2527
2530
2528
- * wedgeprops*: [ *None* | dict of key value pairs ]
2531
+ wedgeprops : dict, optional, default: None
2529
2532
Dict of arguments passed to the wedge objects making the pie.
2530
- For example, you can pass in wedgeprops = { 'linewidth' : 3 }
2533
+ For example, you can pass in`` wedgeprops = {'linewidth': 3}``
2531
2534
to set the width of the wedge border lines equal to 3.
2532
2535
For more details, look at the doc/arguments of the wedge object.
2533
- By default `clip_on=False`.
2536
+ By default `` clip_on=False` `.
2534
2537
2535
- * textprops*: [ *None* | dict of key value pairs ]
2538
+ textprops : dict, optional, default: None
2536
2539
Dict of arguments to pass to the text objects.
2537
2540
2538
- *center*: [ (0,0) | sequence of 2 scalars ]
2539
- Center position of the chart.
2540
-
2541
- *frame*: [ *False* | *True* ]
2542
- Plot axes frame with the chart.
2541
+ center : list of float, optional, default: (0, 0)
2542
+ Center position of the chart. Takes value (0, 0) or is a
2543
+ sequence of 2 scalars.
2543
2544
2544
- *rotatelabels*: [ *False* | *True* ]
2545
- Rotate each label to the angle of the corresponding slice .
2545
+ frame : bool, optional, default: False
2546
+ Plot axes frame with the chart if true .
2546
2547
2547
- The pie chart will probably look best if the figure and axes are
2548
- square, or the Axes aspect is equal. e.g.::
2548
+ rotatelabels : bool, optional, default: False
2549
+ Rotate each label to the angle of the corresponding slice if true.
2549
2550
2550
- figure(figsize=(8,8))
2551
- ax = axes([0.1, 0.1, 0.8, 0.8])
2551
+ Returns
2552
+ -------
2553
+ patches : list
2554
+ A sequence of :class:`matplotlib.patches.Wedge` instances
2552
2555
2553
- or::
2556
+ texts : list
2557
+ A is a list of the label :class:`matplotlib.text.Text` instances.
2554
2558
2555
- axes(aspect=1)
2559
+ autotexts : list
2560
+ A is a list of :class:`~matplotlib.text.Text` instances for the
2561
+ numeric labels. Is returned only if parameter *autopct* is
2562
+ not *None*.
2556
2563
2557
- Return value:
2558
- If *autopct* is *None*, return the tuple (*patches*, *texts*):
2564
+ Notes
2565
+ -----
2566
+ The pie chart will probably look best if the figure and axes are
2567
+ square, or the Axes aspect is equal.
2559
2568
2560
- - *patches* is a sequence of
2561
- :class:`matplotlib.patches.Wedge` instances
2569
+ Examples
2570
+ --------
2571
+ .. plot:: mpl_examples/pie_and_polar_charts/pie_demo_features.py
2562
2572
2563
- - *texts* is a list of the label
2564
- :class:`matplotlib.text.Text` instances.
2565
2573
2566
- If *autopct* is not *None*, return the tuple (*patches*,
2567
- *texts*, *autotexts*), where *patches* and *texts* are as
2568
- above, and *autotexts* is a list of
2569
- :class:`~matplotlib.text.Text` instances for the numeric
2570
- labels.
2571
2574
"""
2572
2575
2573
2576
x = np .array (x , np .float32 )
@@ -2623,9 +2626,9 @@ def get_next_color():
2623
2626
y += expl * math .sin (thetam )
2624
2627
2625
2628
w = mpatches .Wedge ((x , y ), radius , 360. * min (theta1 , theta2 ),
2626
- 360. * max (theta1 , theta2 ),
2627
- facecolor = get_next_color (),
2628
- ** wedgeprops )
2629
+ 360. * max (theta1 , theta2 ),
2630
+ facecolor = get_next_color (),
2631
+ ** wedgeprops )
2629
2632
slices .append (w )
2630
2633
self .add_patch (w )
2631
2634
w .set_label (label )
@@ -2682,9 +2685,9 @@ def get_next_color():
2682
2685
self .set_frame_on (False )
2683
2686
2684
2687
self .set_xlim ((- 1.25 + center [0 ],
2685
- 1.25 + center [0 ]))
2688
+ 1.25 + center [0 ]))
2686
2689
self .set_ylim ((- 1.25 + center [1 ],
2687
- 1.25 + center [1 ]))
2690
+ 1.25 + center [1 ]))
2688
2691
self .set_xticks ([])
2689
2692
self .set_yticks ([])
2690
2693
0 commit comments