@@ -2337,7 +2337,7 @@ def stem(self, *args, **kwargs):
2337
2337
def pie (self , x , explode = None , labels = None , colors = None ,
2338
2338
autopct = None , pctdistance = 0.6 , shadow = False , labeldistance = 1.1 ,
2339
2339
startangle = None , radius = None , counterclock = True ,
2340
- linewidth = None ):
2340
+ ** kwargs ):
2341
2341
r"""
2342
2342
Plot a pie chart.
2343
2343
@@ -2346,7 +2346,9 @@ def pie(self, x, explode=None, labels=None, colors=None,
2346
2346
pie(x, explode=None, labels=None,
2347
2347
colors=('b', 'g', 'r', 'c', 'm', 'y', 'k', 'w'),
2348
2348
autopct=None, pctdistance=0.6, shadow=False,
2349
- labeldistance=1.1, startangle=None, radius=None)
2349
+ labeldistance=1.1, startangle=None, radius=None,
2350
+ wedgeargs={'linewidth':None}, textargs={},
2351
+ )
2350
2352
2351
2353
Make a pie chart of array *x*. The fractional area of each
2352
2354
wedge is given by x/sum(x). If sum(x) <= 1, then the values
@@ -2446,6 +2448,9 @@ def pie(self, x, explode=None, labels=None, colors=None,
2446
2448
else :
2447
2449
theta1 = startangle / 360.0
2448
2450
2451
+ wedgeargs = kwargs .get ('wedgeargs' , {})
2452
+ textargs = kwargs .get ('textargs' , {})
2453
+
2449
2454
texts = []
2450
2455
slices = []
2451
2456
autotexts = []
@@ -2461,7 +2466,7 @@ def pie(self, x, explode=None, labels=None, colors=None,
2461
2466
w = mpatches .Wedge ((x , y ), radius , 360. * min (theta1 , theta2 ),
2462
2467
360. * max (theta1 , theta2 ),
2463
2468
facecolor = colors [i % len (colors )],
2464
- linewidth = linewidth )
2469
+ ** wedgeargs )
2465
2470
slices .append (w )
2466
2471
self .add_patch (w )
2467
2472
w .set_label (label )
@@ -2485,7 +2490,8 @@ def pie(self, x, explode=None, labels=None, colors=None,
2485
2490
t = self .text (xt , yt , label ,
2486
2491
size = rcParams ['xtick.labelsize' ],
2487
2492
horizontalalignment = label_alignment ,
2488
- verticalalignment = 'center' )
2493
+ verticalalignment = 'center' ,
2494
+ ** textargs )
2489
2495
2490
2496
texts .append (t )
2491
2497
@@ -2500,9 +2506,15 @@ def pie(self, x, explode=None, labels=None, colors=None,
2500
2506
raise TypeError (
2501
2507
'autopct must be callable or a format string' )
2502
2508
2509
+ # code review request: not sure if we should pass the
2510
+ # textargs to this call as well. Probably should, but
2511
+ # someone who knows this better should comment.
2503
2512
t = self .text (xt , yt , s ,
2504
2513
horizontalalignment = 'center' ,
2505
- verticalalignment = 'center' )
2514
+ verticalalignment = 'center' ,
2515
+ ** textargs )
2516
+
2517
+
2506
2518
autotexts .append (t )
2507
2519
2508
2520
theta1 = theta2
0 commit comments