56
56
'markeredgecolor' : ['mec' ],
57
57
'markeredgewidth' : ['mew' ],
58
58
'markersize' : ['ms' ],
59
- }
59
+ }
60
60
61
61
62
62
def _plot_args_replacer (args , data ):
@@ -1063,7 +1063,7 @@ def vlines(self, x, ymin, ymax, colors='k', linestyles='solid',
1063
1063
1064
1064
verts = [((thisx , thisymin ), (thisx , thisymax ))
1065
1065
for thisx , thisymin , thisymax in zip (x , ymin , ymax )]
1066
- # print 'creating line collection'
1066
+ #print 'creating line collection'
1067
1067
lines = mcoll .LineCollection (verts , colors = colors ,
1068
1068
linestyles = linestyles , label = label )
1069
1069
self .add_collection (lines , autolim = False )
@@ -1082,9 +1082,9 @@ def vlines(self, x, ymin, ymax, colors='k', linestyles='solid',
1082
1082
return lines
1083
1083
1084
1084
@_preprocess_data (replace_names = ["positions" , "lineoffsets" ,
1085
- "linelengths" , "linewidths" ,
1086
- "colors" , "linestyles" ],
1087
- label_namer = None )
1085
+ "linelengths" , "linewidths" ,
1086
+ "colors" , "linestyles" ],
1087
+ label_namer = None )
1088
1088
@docstring .dedent_interpd
1089
1089
def eventplot (self , positions , orientation = 'horizontal' , lineoffsets = 1 ,
1090
1090
linelengths = 1 , linewidths = None , colors = None ,
@@ -1226,7 +1226,7 @@ def eventplot(self, positions, orientation='horizontal', lineoffsets=1,
1226
1226
colls = []
1227
1227
for position , lineoffset , linelength , linewidth , color , linestyle in \
1228
1228
zip (positions , lineoffsets , linelengths , linewidths ,
1229
- colors , linestyles ):
1229
+ colors , linestyles ):
1230
1230
coll = mcoll .EventCollection (position ,
1231
1231
orientation = orientation ,
1232
1232
lineoffset = lineoffset ,
@@ -1263,8 +1263,8 @@ def eventplot(self, positions, orientation='horizontal', lineoffsets=1,
1263
1263
# ### Basic plotting
1264
1264
# The label_naming happens in `matplotlib.axes._base._plot_args`
1265
1265
@_preprocess_data (replace_names = ["x" , "y" ],
1266
- positional_parameter_names = _plot_args_replacer ,
1267
- label_namer = None )
1266
+ positional_parameter_names = _plot_args_replacer ,
1267
+ label_namer = None )
1268
1268
@docstring .dedent_interpd
1269
1269
def plot (self , * args , ** kwargs ):
1270
1270
"""
@@ -1857,10 +1857,10 @@ def step(self, x, y, *args, **kwargs):
1857
1857
return self .plot (x , y , * args , ** kwargs )
1858
1858
1859
1859
@_preprocess_data (replace_names = ["left" , "height" , "width" , "bottom" ,
1860
- "color" , "edgecolor" , "linewidth" ,
1861
- "tick_label" , "xerr" , "yerr" ,
1862
- "ecolor" ],
1863
- label_namer = None )
1860
+ "color" , "edgecolor" , "linewidth" ,
1861
+ "tick_label" , "xerr" , "yerr" ,
1862
+ "ecolor" ],
1863
+ label_namer = None )
1864
1864
@docstring .dedent_interpd
1865
1865
def bar (self , left , height , width = 0.8 , bottom = None , ** kwargs ):
1866
1866
"""
@@ -2469,108 +2469,105 @@ 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 ,
2476
2476
wedgeprops = None , textprops = None , center = (0 , 0 ),
2477
2477
frame = False , rotatelabels = False ):
2478
- r"""Plot a pie chart.
2478
+ r"""
2479
+ Plot a pie chart.
2479
2480
2480
2481
Make a pie chart of array *x*. The fractional area of each
2481
2482
wedge is given by x/sum(x). If sum(x) <= 1, then the values
2482
2483
of x give the fractional area directly and the array will not
2483
2484
be normalized. The wedges are plotted counterclockwise,
2484
2485
by default starting from the x-axis.
2485
2486
2486
- Parameters
2487
- ----------
2488
- x : array
2489
- The input array used to make the pie chart.
2487
+ Keyword arguments:
2490
2488
2491
- explode: None or array
2489
+ * explode*: [ * None* | len(x) sequence ]
2492
2490
If not *None*, is a ``len(x)`` array which specifies the
2493
2491
fraction of the radius with which to offset each wedge.
2494
2492
2495
- colors: None or array
2493
+ * colors*: [ * None* | color sequence ]
2496
2494
A sequence of matplotlib color args through which the pie chart
2497
2495
will cycle. If `None`, will use the colors in the currently
2498
2496
active cycle.
2499
2497
2500
- labels: None or list
2498
+ * labels*: [ * None* | len(x) sequence of strings ]
2501
2499
A sequence of strings providing the labels for each wedge
2502
2500
2503
- autopct: None or string or function
2501
+ * autopct*: [ * None* | format string | format function ]
2504
2502
If not *None*, is a string or function used to label the wedges
2505
2503
with their numeric value. The label will be placed inside the
2506
2504
wedge. If it is a format string, the label will be ``fmt%pct``.
2507
2505
If it is a function, it will be called.
2508
2506
2509
- pctdistance: float
2507
+ * pctdistance*: scalar
2510
2508
The ratio between the center of each pie slice and the
2511
2509
start of the text generated by *autopct*. Ignored if
2512
2510
*autopct* is *None*; default is 0.6.
2513
2511
2514
- labeldistance: float
2512
+ * labeldistance*: scalar
2515
2513
The radial distance at which the pie labels are drawn
2516
2514
2517
- shadow: bool
2515
+ * shadow*: [ *False* | *True* ]
2518
2516
Draw a shadow beneath the pie.
2519
2517
2520
- startangle: None or Offset angle
2518
+ * startangle*: [ * None* | Offset angle ]
2521
2519
If not *None*, rotates the start of the pie chart by *angle*
2522
2520
degrees counterclockwise from the x-axis.
2523
2521
2524
- radius: None or float
2522
+ * radius*: [ * None* | scalar ]
2525
2523
The radius of the pie, if *radius* is *None* it will be set to 1.
2526
2524
2527
- counterclock: bool
2525
+ * counterclock*: [ *False* | *True* ]
2528
2526
Specify fractions direction, clockwise or counterclockwise.
2529
2527
2530
- wedgeprops: None or dict
2528
+ * wedgeprops*: [ * None* | dict of key value pairs ]
2531
2529
Dict of arguments passed to the wedge objects making the pie.
2532
2530
For example, you can pass in wedgeprops = { 'linewidth' : 3 }
2533
2531
to set the width of the wedge border lines equal to 3.
2534
2532
For more details, look at the doc/arguments of the wedge object.
2535
2533
By default `clip_on=False`.
2536
2534
2537
- textprops: None or dict
2535
+ * textprops*: [ * None* | dict of key value pairs ]
2538
2536
Dict of arguments to pass to the text objects.
2539
2537
2540
- center: list of int
2541
- Center position of the chart. Takes value (0,0) or is a sequence
2542
- of 2 scalars.
2538
+ *center*: [ (0,0) | sequence of 2 scalars ]
2539
+ Center position of the chart.
2543
2540
2544
- frame: bool
2545
- Plot axes frame with the chart if true .
2541
+ * frame*: [ *False* | *True* ]
2542
+ Plot axes frame with the chart.
2546
2543
2547
- rotatelabels: bool
2548
- Rotate each label to the angle of the corresponding slice if true .
2544
+ * rotatelabels*: [ *False* | *True* ]
2545
+ Rotate each label to the angle of the corresponding slice.
2549
2546
2550
- Returns
2551
- -------
2552
- patches: list
2553
- A sequence of :class:`matplotlib.patches.Wedge` instances
2547
+ The pie chart will probably look best if the figure and axes are
2548
+ square, or the Axes aspect is equal. e.g.::
2554
2549
2555
- texts: list
2556
- A is a list of the label :class:`matplotlib.text.Text` instances.
2550
+ figure(figsize=(8,8))
2551
+ ax = axes([0.1, 0.1, 0.8, 0.8])
2557
2552
2558
- autotexts: list
2559
- A is a list of :class:`~matplotlib.text.Text` instances for the
2560
- numeric labels. Is returned only is if parameter *autopct* is
2561
- not *None*. If *autopct* is *None*, the tuple returned
2562
- is (patches, texts).
2553
+ or::
2563
2554
2564
- Examples
2565
- --------
2566
- The pie chart will probably look best if the figure and axes are
2567
- square, or the Axes aspect is equal.
2555
+ axes(aspect=1)
2556
+
2557
+ Return value:
2558
+ If *autopct* is *None*, return the tuple (*patches*, *texts*):
2568
2559
2569
- >>> figure(figsize=(8,8))
2570
- >>> ax = axes([0.1, 0.1, 0.8, 0.8])
2560
+ - *patches* is a sequence of
2561
+ :class:`matplotlib.patches.Wedge` instances
2571
2562
2572
- >>> axes(aspect=1)
2563
+ - *texts* is a list of the label
2564
+ :class:`matplotlib.text.Text` instances.
2573
2565
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.
2574
2571
"""
2575
2572
2576
2573
x = np .array (x , np .float32 )
@@ -2626,9 +2623,9 @@ def get_next_color():
2626
2623
y += expl * math .sin (thetam )
2627
2624
2628
2625
w = mpatches .Wedge ((x , y ), radius , 360. * min (theta1 , theta2 ),
2629
- 360. * max (theta1 , theta2 ),
2630
- facecolor = get_next_color (),
2631
- ** wedgeprops )
2626
+ 360. * max (theta1 , theta2 ),
2627
+ facecolor = get_next_color (),
2628
+ ** wedgeprops )
2632
2629
slices .append (w )
2633
2630
self .add_patch (w )
2634
2631
w .set_label (label )
@@ -2685,9 +2682,9 @@ def get_next_color():
2685
2682
self .set_frame_on (False )
2686
2683
2687
2684
self .set_xlim ((- 1.25 + center [0 ],
2688
- 1.25 + center [0 ]))
2685
+ 1.25 + center [0 ]))
2689
2686
self .set_ylim ((- 1.25 + center [1 ],
2690
- 1.25 + center [1 ]))
2687
+ 1.25 + center [1 ]))
2691
2688
self .set_xticks ([])
2692
2689
self .set_yticks ([])
2693
2690
@@ -2697,7 +2694,7 @@ def get_next_color():
2697
2694
return slices , texts , autotexts
2698
2695
2699
2696
@_preprocess_data (replace_names = ["x" , "y" , "xerr" , "yerr" ],
2700
- label_namer = "y" )
2697
+ label_namer = "y" )
2701
2698
@docstring .dedent_interpd
2702
2699
def errorbar (self , x , y , yerr = None , xerr = None ,
2703
2700
fmt = '' , ecolor = None , elinewidth = None , capsize = None ,
@@ -3308,8 +3305,7 @@ def _update_dict(dictionary, rc_name, properties):
3308
3305
dictionary = dict ()
3309
3306
for prop_dict in properties :
3310
3307
dictionary .setdefault (prop_dict ,
3311
- rcParams [rc_str .format (rc_name ,
3312
- prop_dict )])
3308
+ rcParams [rc_str .format (rc_name , prop_dict )])
3313
3309
return dictionary
3314
3310
3315
3311
# Common property dictionnaries loading from rc
@@ -3319,7 +3315,7 @@ def _update_dict(dictionary, rc_name, properties):
3319
3315
3320
3316
boxprops = _update_dict (boxprops , 'boxprops' , default_props )
3321
3317
whiskerprops = _update_dict (whiskerprops , 'whiskerprops' ,
3322
- default_props )
3318
+ default_props )
3323
3319
capprops = _update_dict (capprops , 'capprops' , default_props )
3324
3320
medianprops = _update_dict (medianprops , 'medianprops' , default_props )
3325
3321
meanprops = _update_dict (meanprops , 'meanprops' , default_props )
@@ -3811,9 +3807,9 @@ def dopatch(xs, ys, **kwargs):
3811
3807
medians = medians , fliers = fliers , means = means )
3812
3808
3813
3809
@_preprocess_data (replace_names = ["x" , "y" , "s" , "linewidths" ,
3814
- "edgecolors" , "c" , 'facecolor' ,
3815
- 'facecolors' , 'color' ],
3816
- label_namer = "y" )
3810
+ "edgecolors" , "c" , 'facecolor' ,
3811
+ 'facecolors' , 'color' ],
3812
+ label_namer = "y" )
3817
3813
def scatter (self , x , y , s = None , c = None , marker = None , cmap = None , norm = None ,
3818
3814
vmin = None , vmax = None , alpha = None , linewidths = None ,
3819
3815
verts = None , edgecolors = None ,
@@ -4617,7 +4613,7 @@ def stackplot(self, x, *args, **kwargs):
4617
4613
stackplot .__doc__ = mstack .stackplot .__doc__
4618
4614
4619
4615
@_preprocess_data (replace_names = ["x" , "y" , "u" , "v" , "start_points" ],
4620
- label_namer = None )
4616
+ label_namer = None )
4621
4617
def streamplot (self , x , y , u , v , density = 1 , linewidth = None , color = None ,
4622
4618
cmap = None , norm = None , arrowsize = 1 , arrowstyle = '-|>' ,
4623
4619
minlength = 0.1 , transform = None , zorder = None ,
@@ -4717,7 +4713,7 @@ def fill(self, *args, **kwargs):
4717
4713
return patches
4718
4714
4719
4715
@_preprocess_data (replace_names = ["x" , "y1" , "y2" , "where" ],
4720
- label_namer = None )
4716
+ label_namer = None )
4721
4717
@docstring .dedent_interpd
4722
4718
def fill_between (self , x , y1 , y2 = 0 , where = None , interpolate = False ,
4723
4719
step = None ,
@@ -4886,7 +4882,7 @@ def get_interp_point(ind):
4886
4882
return collection
4887
4883
4888
4884
@_preprocess_data (replace_names = ["y" , "x1" , "x2" , "where" ],
4889
- label_namer = None )
4885
+ label_namer = None )
4890
4886
@docstring .dedent_interpd
4891
4887
def fill_betweenx (self , y , x1 , x2 = 0 , where = None ,
4892
4888
step = None , interpolate = False , ** kwargs ):
@@ -5185,7 +5181,7 @@ def imshow(self, X, cmap=None, norm=None, aspect=None,
5185
5181
if im .get_clip_path () is None :
5186
5182
# image does not already have clipping set, clip to axes patch
5187
5183
im .set_clip_path (self .patch )
5188
- # if norm is None and shape is None:
5184
+ #if norm is None and shape is None:
5189
5185
# im.set_clim(vmin, vmax)
5190
5186
if vmin is not None or vmax is not None :
5191
5187
im .set_clim (vmin , vmax )
@@ -5245,7 +5241,7 @@ def _pcolorargs(funcname, *args, **kw):
5245
5241
if X .shape != Y .shape :
5246
5242
raise TypeError (
5247
5243
'Incompatible X, Y inputs to %s; see help(%s)' % (
5248
- funcname , funcname ))
5244
+ funcname , funcname ))
5249
5245
if allmatch :
5250
5246
if not (Nx == numCols and Ny == numRows ):
5251
5247
raise TypeError ('Dimensions of C %s are incompatible with'
@@ -5497,7 +5493,7 @@ def pcolor(self, *args, **kwargs):
5497
5493
# Transform from native to data coordinates?
5498
5494
t = collection ._transform
5499
5495
if (not isinstance (t , mtransforms .Transform ) and
5500
- hasattr (t , '_as_mpl_transform' )):
5496
+ hasattr (t , '_as_mpl_transform' )):
5501
5497
t = t ._as_mpl_transform (self .axes )
5502
5498
5503
5499
if t and any (t .contains_branch_seperately (self .transData )):
@@ -5649,7 +5645,7 @@ def pcolormesh(self, *args, **kwargs):
5649
5645
# Transform from native to data coordinates?
5650
5646
t = collection ._transform
5651
5647
if (not isinstance (t , mtransforms .Transform ) and
5652
- hasattr (t , '_as_mpl_transform' )):
5648
+ hasattr (t , '_as_mpl_transform' )):
5653
5649
t = t ._as_mpl_transform (self .axes )
5654
5650
5655
5651
if t and any (t .contains_branch_seperately (self .transData )):
@@ -7348,7 +7344,7 @@ def spy(self, Z, precision=0, marker=None, markersize=None,
7348
7344
nr , nc = Z .shape
7349
7345
extent = [- 0.5 , nc - 0.5 , nr - 0.5 , - 0.5 ]
7350
7346
ret = self .imshow (mask , interpolation = 'nearest' , aspect = aspect ,
7351
- extent = extent , origin = origin , ** kwargs )
7347
+ extent = extent , origin = origin , ** kwargs )
7352
7348
else :
7353
7349
if hasattr (Z , 'tocoo' ):
7354
7350
c = Z .tocoo ()
@@ -7368,8 +7364,7 @@ def spy(self, Z, precision=0, marker=None, markersize=None,
7368
7364
if markersize is None :
7369
7365
markersize = 10
7370
7366
marks = mlines .Line2D (x , y , linestyle = 'None' ,
7371
- marker = marker , markersize = markersize ,
7372
- ** kwargs )
7367
+ marker = marker , markersize = markersize , ** kwargs )
7373
7368
self .add_line (marks )
7374
7369
nr , nc = Z .shape
7375
7370
self .set_xlim (xmin = - 0.5 , xmax = nc - 0.5 )
@@ -7380,9 +7375,11 @@ def spy(self, Z, precision=0, marker=None, markersize=None,
7380
7375
self .xaxis .tick_top ()
7381
7376
self .xaxis .set_ticks_position ('both' )
7382
7377
self .xaxis .set_major_locator (mticker .MaxNLocator (nbins = 9 ,
7383
- steps = [1 , 2 , 5 , 10 ], integer = True ))
7378
+ steps = [1 , 2 , 5 , 10 ],
7379
+ integer = True ))
7384
7380
self .yaxis .set_major_locator (mticker .MaxNLocator (nbins = 9 ,
7385
- steps = [1 , 2 , 5 , 10 ], integer = True ))
7381
+ steps = [1 , 2 , 5 , 10 ],
7382
+ integer = True ))
7386
7383
return ret
7387
7384
7388
7385
def matshow (self , Z , ** kwargs ):
@@ -7427,10 +7424,11 @@ def matshow(self, Z, **kwargs):
7427
7424
self .xaxis .tick_top ()
7428
7425
self .xaxis .set_ticks_position ('both' )
7429
7426
self .xaxis .set_major_locator (mticker .MaxNLocator (nbins = 9 ,
7430
- steps = [1 , 2 , 5 , 10 ], integer = True ))
7427
+ steps = [1 , 2 , 5 , 10 ],
7428
+ integer = True ))
7431
7429
self .yaxis .set_major_locator (mticker .MaxNLocator (nbins = 9 ,
7432
- steps = [1 , 2 , 5 , 10 ],
7433
- integer = True ))
7430
+ steps = [1 , 2 , 5 , 10 ],
7431
+ integer = True ))
7434
7432
return im
7435
7433
7436
7434
@_preprocess_data (replace_names = ["dataset" ], label_namer = None )
0 commit comments