@@ -532,14 +532,14 @@ def test_nonfinite_limits():
532
532
@image_comparison (baseline_images = ['imshow' ],
533
533
remove_text = True )
534
534
def test_imshow ():
535
- #Create a NxN image
535
+ # Create a NxN image
536
536
N = 100
537
537
(x , y ) = np .indices ((N , N ))
538
538
x -= N // 2
539
539
y -= N // 2
540
540
r = np .sqrt (x ** 2 + y ** 2 - x * y )
541
541
542
- #Create a contour plot at N/4 and extract both the clip path and transform
542
+ # Create a contour plot at N/4 and extract both the clip path and transform
543
543
fig = plt .figure ()
544
544
ax = fig .add_subplot (111 )
545
545
@@ -550,14 +550,14 @@ def test_imshow():
550
550
def test_imshow_clip ():
551
551
# As originally reported by Gellule Xg <gellule.xg@free.fr>
552
552
553
- #Create a NxN image
553
+ # Create a NxN image
554
554
N = 100
555
555
(x , y ) = np .indices ((N , N ))
556
556
x -= N // 2
557
557
y -= N // 2
558
558
r = np .sqrt (x ** 2 + y ** 2 - x * y )
559
559
560
- #Create a contour plot at N/4 and extract both the clip path and transform
560
+ # Create a contour plot at N/4 and extract both the clip path and transform
561
561
fig = plt .figure ()
562
562
ax = fig .add_subplot (111 )
563
563
@@ -569,7 +569,7 @@ def test_imshow_clip():
569
569
from matplotlib .transforms import TransformedPath
570
570
clip_path = TransformedPath (clipPath , clipTransform )
571
571
572
- #Plot the image clipped by the contour
572
+ # Plot the image clipped by the contour
573
573
ax .imshow (r , clip_path = clip_path )
574
574
575
575
@@ -851,12 +851,12 @@ def test_markevery_line():
851
851
remove_text = True )
852
852
def test_markevery_linear_scales ():
853
853
cases = [None ,
854
- 8 ,
855
- (30 , 8 ),
856
- [16 , 24 , 30 ], [0 ,- 1 ],
857
- slice (100 , 200 , 3 ),
858
- 0.1 , 0.3 , 1.5 ,
859
- (0.0 , 0.1 ), (0.45 , 0.1 )]
854
+ 8 ,
855
+ (30 , 8 ),
856
+ [16 , 24 , 30 ], [0 , - 1 ],
857
+ slice (100 , 200 , 3 ),
858
+ 0.1 , 0.3 , 1.5 ,
859
+ (0.0 , 0.1 ), (0.45 , 0.1 )]
860
860
861
861
cols = 3
862
862
gs = matplotlib .gridspec .GridSpec (len (cases ) // cols + 1 , cols )
@@ -872,16 +872,17 @@ def test_markevery_linear_scales():
872
872
plt .title ('markevery=%s' % str (case ))
873
873
plt .plot (x , y , 'o' , ls = '-' , ms = 4 , markevery = case )
874
874
875
+
875
876
@image_comparison (baseline_images = ['markevery_linear_scales_zoomed' ],
876
877
remove_text = True )
877
878
def test_markevery_linear_scales_zoomed ():
878
879
cases = [None ,
879
- 8 ,
880
- (30 , 8 ),
881
- [16 , 24 , 30 ], [0 ,- 1 ],
882
- slice (100 , 200 , 3 ),
883
- 0.1 , 0.3 , 1.5 ,
884
- (0.0 , 0.1 ), (0.45 , 0.1 )]
880
+ 8 ,
881
+ (30 , 8 ),
882
+ [16 , 24 , 30 ], [0 , - 1 ],
883
+ slice (100 , 200 , 3 ),
884
+ 0.1 , 0.3 , 1.5 ,
885
+ (0.0 , 0.1 ), (0.45 , 0.1 )]
885
886
886
887
cols = 3
887
888
gs = matplotlib .gridspec .GridSpec (len (cases ) // cols + 1 , cols )
@@ -904,12 +905,12 @@ def test_markevery_linear_scales_zoomed():
904
905
remove_text = True )
905
906
def test_markevery_log_scales ():
906
907
cases = [None ,
907
- 8 ,
908
- (30 , 8 ),
909
- [16 , 24 , 30 ], [0 ,- 1 ],
910
- slice (100 , 200 , 3 ),
911
- 0.1 , 0.3 , 1.5 ,
912
- (0.0 , 0.1 ), (0.45 , 0.1 )]
908
+ 8 ,
909
+ (30 , 8 ),
910
+ [16 , 24 , 30 ], [0 , - 1 ],
911
+ slice (100 , 200 , 3 ),
912
+ 0.1 , 0.3 , 1.5 ,
913
+ (0.0 , 0.1 ), (0.45 , 0.1 )]
913
914
914
915
cols = 3
915
916
gs = matplotlib .gridspec .GridSpec (len (cases ) // cols + 1 , cols )
@@ -927,16 +928,17 @@ def test_markevery_log_scales():
927
928
plt .yscale ('log' )
928
929
plt .plot (x , y , 'o' , ls = '-' , ms = 4 , markevery = case )
929
930
931
+
930
932
@image_comparison (baseline_images = ['markevery_polar' ],
931
933
remove_text = True )
932
934
def test_markevery_polar ():
933
935
cases = [None ,
934
- 8 ,
935
- (30 , 8 ),
936
- [16 , 24 , 30 ], [0 ,- 1 ],
937
- slice (100 , 200 , 3 ),
938
- 0.1 , 0.3 , 1.5 ,
939
- (0.0 , 0.1 ), (0.45 , 0.1 )]
936
+ 8 ,
937
+ (30 , 8 ),
938
+ [16 , 24 , 30 ], [0 , - 1 ],
939
+ slice (100 , 200 , 3 ),
940
+ 0.1 , 0.3 , 1.5 ,
941
+ (0.0 , 0.1 ), (0.45 , 0.1 )]
940
942
941
943
cols = 3
942
944
gs = matplotlib .gridspec .GridSpec (len (cases ) // cols + 1 , cols )
@@ -947,7 +949,7 @@ def test_markevery_polar():
947
949
for i , case in enumerate (cases ):
948
950
row = (i // cols )
949
951
col = i % cols
950
- plt .subplot (gs [row , col ], polar = True )
952
+ plt .subplot (gs [row , col ], polar = True )
951
953
plt .title ('markevery=%s' % str (case ))
952
954
plt .plot (theta , r , 'o' , ls = '-' , ms = 4 , markevery = case )
953
955
@@ -988,7 +990,6 @@ def test_hist_steplog():
988
990
ax = plt .subplot (4 , 1 , 2 )
989
991
plt .hist (data_pos , 100 , histtype = 'stepfilled' , log = True )
990
992
991
-
992
993
ax = plt .subplot (4 , 1 , 3 )
993
994
plt .hist (data , 100 , weights = weights , histtype = 'stepfilled' , log = True )
994
995
@@ -1040,7 +1041,7 @@ def test_contour_colorbar():
1040
1041
@image_comparison (baseline_images = ['hist2d' ])
1041
1042
def test_hist2d ():
1042
1043
np .random .seed (0 )
1043
- #make it not symetric in case we switch x and y axis
1044
+ # make it not symetric in case we switch x and y axis
1044
1045
x = np .random .randn (100 )* 2 + 5
1045
1046
y = np .random .randn (100 )- 2
1046
1047
fig = plt .figure ()
@@ -1051,8 +1052,8 @@ def test_hist2d():
1051
1052
@image_comparison (baseline_images = ['hist2d_transpose' ])
1052
1053
def test_hist2d_transpose ():
1053
1054
np .random .seed (0 )
1054
- #make sure the the output from np.histogram is transposed before
1055
- #passing to pcolorfast
1055
+ # make sure the the output from np.histogram is transposed before
1056
+ # passing to pcolorfast
1056
1057
x = np .array ([5 ]* 100 )
1057
1058
y = np .random .randn (100 )- 2
1058
1059
fig = plt .figure ()
@@ -1601,6 +1602,7 @@ def test_boxplot_bad_medians_1():
1601
1602
fig , ax = plt .subplots ()
1602
1603
assert_raises (ValueError , ax .boxplot , x , usermedians = [1 , 2 ])
1603
1604
1605
+
1604
1606
@cleanup
1605
1607
def test_boxplot_bad_medians_2 ():
1606
1608
x = np .linspace (- 7 , 7 , 140 )
@@ -1808,7 +1810,7 @@ def test_manage_xticks():
1808
1810
np .random .seed (0 )
1809
1811
y1 = np .random .normal (10 , 3 , 20 )
1810
1812
y2 = np .random .normal (3 , 1 , 20 )
1811
- ax .boxplot ([y1 , y2 ], positions = [1 ,2 ],
1813
+ ax .boxplot ([y1 , y2 ], positions = [1 , 2 ],
1812
1814
manage_xticks = False )
1813
1815
new_xlim = ax .get_xlim ()
1814
1816
assert_array_equal (old_xlim , new_xlim )
@@ -2192,6 +2194,16 @@ def test_empty_eventplot():
2192
2194
plt .draw ()
2193
2195
2194
2196
2197
+ @image_comparison (baseline_images = ['marker_styles' ], extensions = ['png' ], remove_text = True )
2198
+ def test_marker_styles ():
2199
+ fig = plt .figure ()
2200
+ ax = fig .add_subplot (111 )
2201
+ for y , marker in enumerate (sorted (matplotlib .markers .MarkerStyle .markers .keys (),
2202
+ key = lambda x : str (type (x ))+ str (x ))):
2203
+ ax .plot ((y % 2 )* 5 + np .arange (10 )* 10 , np .ones (10 )* 10 * y , linestyle = '' , marker = marker ,
2204
+ markersize = 10 + y / 5 , label = marker )
2205
+
2206
+
2195
2207
@image_comparison (baseline_images = ['vertex_markers' ], extensions = ['png' ],
2196
2208
remove_text = True )
2197
2209
def test_vertex_markers ():
@@ -3251,7 +3263,7 @@ def test_vline_limit():
3251
3263
3252
3264
@cleanup
3253
3265
def test_empty_shared_subplots ():
3254
- #empty plots with shared axes inherit limits from populated plots
3266
+ # empty plots with shared axes inherit limits from populated plots
3255
3267
fig , axes = plt .subplots (nrows = 1 , ncols = 2 , sharex = True , sharey = True )
3256
3268
axes [0 ].plot ([1 , 2 , 3 ], [2 , 4 , 6 ])
3257
3269
x0 , x1 = axes [1 ].get_xlim ()
@@ -3305,7 +3317,7 @@ def test_pie_linewidth_0():
3305
3317
labels = 'Frogs' , 'Hogs' , 'Dogs' , 'Logs'
3306
3318
sizes = [15 , 30 , 45 , 10 ]
3307
3319
colors = ['yellowgreen' , 'gold' , 'lightskyblue' , 'lightcoral' ]
3308
- explode = (0 , 0.1 , 0 , 0 ) # only "explode" the 2nd slice (i.e. 'Hogs')
3320
+ explode = (0 , 0.1 , 0 , 0 ) # only "explode" the 2nd slice (i.e. 'Hogs')
3309
3321
3310
3322
plt .pie (sizes , explode = explode , labels = labels , colors = colors ,
3311
3323
autopct = '%1.1f%%' , shadow = True , startangle = 90 ,
@@ -3320,7 +3332,7 @@ def test_pie_linewidth_2():
3320
3332
labels = 'Frogs' , 'Hogs' , 'Dogs' , 'Logs'
3321
3333
sizes = [15 , 30 , 45 , 10 ]
3322
3334
colors = ['yellowgreen' , 'gold' , 'lightskyblue' , 'lightcoral' ]
3323
- explode = (0 , 0.1 , 0 , 0 ) # only "explode" the 2nd slice (i.e. 'Hogs')
3335
+ explode = (0 , 0.1 , 0 , 0 ) # only "explode" the 2nd slice (i.e. 'Hogs')
3324
3336
3325
3337
plt .pie (sizes , explode = explode , labels = labels , colors = colors ,
3326
3338
autopct = '%1.1f%%' , shadow = True , startangle = 90 ,
@@ -3335,14 +3347,15 @@ def test_pie_ccw_true():
3335
3347
labels = 'Frogs' , 'Hogs' , 'Dogs' , 'Logs'
3336
3348
sizes = [15 , 30 , 45 , 10 ]
3337
3349
colors = ['yellowgreen' , 'gold' , 'lightskyblue' , 'lightcoral' ]
3338
- explode = (0 , 0.1 , 0 , 0 ) # only "explode" the 2nd slice (i.e. 'Hogs')
3350
+ explode = (0 , 0.1 , 0 , 0 ) # only "explode" the 2nd slice (i.e. 'Hogs')
3339
3351
3340
3352
plt .pie (sizes , explode = explode , labels = labels , colors = colors ,
3341
3353
autopct = '%1.1f%%' , shadow = True , startangle = 90 ,
3342
3354
counterclock = True )
3343
3355
# Set aspect ratio to be equal so that pie is drawn as a circle.
3344
3356
plt .axis ('equal' )
3345
3357
3358
+
3346
3359
@cleanup
3347
3360
def test_margins ():
3348
3361
# test all ways margins can be called
@@ -3363,6 +3376,7 @@ def test_margins():
3363
3376
ax3 .margins (x = 1 , y = 0.5 )
3364
3377
assert_equal (ax3 .margins (), (1 , 0.5 ))
3365
3378
3379
+
3366
3380
@cleanup
3367
3381
def test_pathological_hexbin ():
3368
3382
# issue #2863
0 commit comments