@@ -2899,7 +2899,7 @@ def stem(self, *args, linefmt=None, markerfmt=None, basefmt=None, bottom=0,
28992899 @_preprocess_data (replace_names = ["x" , "explode" , "labels" , "colors" ])
29002900 def pie (self , x , explode = None , labels = None , colors = None ,
29012901 autopct = None , pctdistance = 0.6 , shadow = False , labeldistance = 1.1 ,
2902- startangle = None , radius = None , counterclock = True ,
2902+ startangle = 0 , radius = 1 , counterclock = True ,
29032903 wedgeprops = None , textprops = None , center = (0 , 0 ),
29042904 frame = False , rotatelabels = False ):
29052905 """
@@ -2932,7 +2932,7 @@ def pie(self, x, explode=None, labels=None, colors=None,
29322932 autopct : None or str or callable, default: None
29332933 If not *None*, is a string or function used to label the wedges
29342934 with their numeric value. The label will be placed inside the
2935- wedge. If it is a format string, the label will be ``fmt% pct``.
2935+ wedge. If it is a format string, the label will be ``fmt % pct``.
29362936 If it is a function, it will be called.
29372937
29382938 pctdistance : float, default: 0.6
@@ -2947,12 +2947,12 @@ def pie(self, x, explode=None, labels=None, colors=None,
29472947 If set to ``None``, label are not drawn, but are stored for use in
29482948 ``legend()``
29492949
2950- startangle : float, default: None
2951- If not *None*, rotates the start of the pie chart by *angle*
2952- degrees counterclockwise from the x-axis.
2950+ startangle : float, default: 0 degrees
2951+ The angle by which the start of the pie is rotated,
2952+ counterclockwise from the x-axis.
29532953
2954- radius : float, default: None
2955- The radius of the pie, if *radius* is *None* it will be set to 1 .
2954+ radius : float, default: 1
2955+ The radius of the pie.
29562956
29572957 counterclock : bool, default: True
29582958 Specify fractions direction, clockwise or counterclockwise.
@@ -3030,22 +3030,25 @@ def get_next_color():
30303030 return next (color_cycle )
30313031
30323032 if radius is None :
3033+ cbook .warn_deprecated (
3034+ "3.3" , message = "Support for passing a radius of None to mean "
3035+ "1 is deprecated since %(since)s and will be removed "
3036+ "%(removal)s." )
30333037 radius = 1
30343038
30353039 # Starting theta1 is the start fraction of the circle
30363040 if startangle is None :
3037- theta1 = 0
3038- else :
3039- theta1 = startangle / 360.0
3041+ cbook .warn_deprecated (
3042+ "3.3" , message = "Support for passing a startangle of None to "
3043+ "mean 0 is deprecated since %(since)s and will be removed "
3044+ "%(removal)s." )
3045+ startangle = 0
3046+ theta1 = startangle / 360
30403047
3041- # set default values in wedge_prop
30423048 if wedgeprops is None :
30433049 wedgeprops = {}
3044- wedgeprops .setdefault ('clip_on' , False )
3045-
30463050 if textprops is None :
30473051 textprops = {}
3048- textprops .setdefault ('clip_on' , False )
30493052
30503053 texts = []
30513054 slices = []
@@ -3061,18 +3064,17 @@ def get_next_color():
30613064 w = mpatches .Wedge ((x , y ), radius , 360. * min (theta1 , theta2 ),
30623065 360. * max (theta1 , theta2 ),
30633066 facecolor = get_next_color (),
3064- ** wedgeprops )
3067+ clip_on = False ,
3068+ label = label )
3069+ w .set (** wedgeprops )
30653070 slices .append (w )
30663071 self .add_patch (w )
3067- w .set_label (label )
30683072
30693073 if shadow :
3070- # make sure to add a shadow after the call to
3071- # add_patch so the figure and transform props will be
3072- # set
3074+ # Make sure to add a shadow after the call to add_patch so the
3075+ # figure and transform props will be set.
30733076 shad = mpatches .Shadow (w , - 0.02 , - 0.02 )
3074- shad .set_zorder (0.9 * w .get_zorder ())
3075- shad .set_label ('_nolegend_' )
3077+ shad .set (zorder = 0.9 * w .get_zorder (), label = '_nolegend_' )
30763078 self .add_patch (shad )
30773079
30783080 if labeldistance is not None :
@@ -3085,14 +3087,13 @@ def get_next_color():
30853087 label_alignment_v = 'bottom' if yt > 0 else 'top'
30863088 label_rotation = (np .rad2deg (thetam )
30873089 + (0 if xt > 0 else 180 ))
3088- props = dict (horizontalalignment = label_alignment_h ,
3089- verticalalignment = label_alignment_v ,
3090- rotation = label_rotation ,
3091- size = rcParams ['xtick.labelsize' ])
3092- props .update (textprops )
3093-
3094- t = self .text (xt , yt , label , ** props )
3095-
3090+ t = self .text (xt , yt , label ,
3091+ clip_on = False ,
3092+ horizontalalignment = label_alignment_h ,
3093+ verticalalignment = label_alignment_v ,
3094+ rotation = label_rotation ,
3095+ size = rcParams ['xtick.labelsize' ])
3096+ t .set (** textprops )
30963097 texts .append (t )
30973098
30983099 if autopct is not None :
@@ -3105,25 +3106,19 @@ def get_next_color():
31053106 else :
31063107 raise TypeError (
31073108 'autopct must be callable or a format string' )
3108-
3109- props = dict (horizontalalignment = 'center' ,
3110- verticalalignment = 'center' )
3111- props .update (textprops )
3112- t = self .text (xt , yt , s , ** props )
3113-
3109+ t = self .text (xt , yt , s ,
3110+ clip_on = False ,
3111+ horizontalalignment = 'center' ,
3112+ verticalalignment = 'center' )
3113+ t .set (** textprops )
31143114 autotexts .append (t )
31153115
31163116 theta1 = theta2
31173117
31183118 if not frame :
3119- self .set_frame_on (False )
3120-
3121- self .set_xlim ((- 1.25 + center [0 ],
3122- 1.25 + center [0 ]))
3123- self .set_ylim ((- 1.25 + center [1 ],
3124- 1.25 + center [1 ]))
3125- self .set_xticks ([])
3126- self .set_yticks ([])
3119+ self .set (frame_on = False , xticks = [], yticks = [],
3120+ xlim = (- 1.25 + center [0 ], 1.25 + center [0 ]),
3121+ ylim = (- 1.25 + center [1 ], 1.25 + center [1 ]))
31273122
31283123 if autopct is None :
31293124 return slices , texts
0 commit comments