12
12
import numpy as np
13
13
14
14
from matplotlib .testing .decorators import image_comparison , cleanup
15
- from matplotlib .cbook import MatplotlibDeprecationWarning
16
15
import matplotlib .pyplot as plt
17
16
import matplotlib as mpl
18
- import matplotlib .patches as mpatches
19
17
import matplotlib .transforms as mtrans
20
- import matplotlib .collections as mc
18
+ import matplotlib .collections as mcollections
19
+
21
20
22
21
@image_comparison (baseline_images = ['legend_auto1' ], remove_text = True )
23
22
def test_legend_auto1 ():
@@ -110,7 +109,8 @@ def test_fancy():
110
109
plt .subplot (121 )
111
110
plt .scatter (list (xrange (10 )), list (xrange (10 , 0 , - 1 )), label = 'XX\n XX' )
112
111
plt .plot ([5 ] * 10 , 'o--' , label = 'XX' )
113
- plt .errorbar (list (xrange (10 )), list (xrange (10 )), xerr = 0.5 , yerr = 0.5 , label = 'XX' )
112
+ plt .errorbar (list (xrange (10 )), list (xrange (10 )), xerr = 0.5 ,
113
+ yerr = 0.5 , label = 'XX' )
114
114
plt .legend (loc = "center left" , bbox_to_anchor = [1.0 , 0.5 ],
115
115
ncol = 2 , shadow = True , title = "My legend" , numpoints = 1 )
116
116
@@ -123,7 +123,8 @@ def test_framealpha():
123
123
plt .legend (framealpha = 0.5 )
124
124
125
125
126
- @image_comparison (baseline_images = ['scatter_rc3' , 'scatter_rc1' ], remove_text = True )
126
+ @image_comparison (baseline_images = ['scatter_rc3' , 'scatter_rc1' ],
127
+ remove_text = True )
127
128
def test_rc ():
128
129
# using subplot triggers some offsetbox functionality untested elsewhere
129
130
fig = plt .figure ()
@@ -221,8 +222,8 @@ def test_warn_args_kwargs(self):
221
222
ax .legend ((lnc , lns ), labels = ('a' , 'b' ))
222
223
223
224
warn .assert_called_with ("You have mixed positional and keyword "
224
- "arguments, some input will be "
225
- "discarded." )
225
+ "arguments, some input will be "
226
+ "discarded." )
226
227
227
228
228
229
@image_comparison (baseline_images = ['legend_stackplot' ], extensions = ['png' ])
@@ -273,10 +274,10 @@ def test_nanscatter():
273
274
274
275
@image_comparison (baseline_images = ['not_covering_scatter' ], extensions = ['png' ])
275
276
def test_not_covering_scatter ():
276
- colors = ['b' ,'g' ,'r' ]
277
+ colors = ['b' , 'g' , 'r' ]
277
278
278
279
for n in range (3 ):
279
- plt .scatter ([n , ], [n , ], color = colors [n ])
280
+ plt .scatter ([n ], [n ], color = colors [n ])
280
281
281
282
plt .legend (['foo' , 'foo' , 'foo' ], loc = 'best' )
282
283
plt .gca ().set_xlim (- 0.5 , 2.2 )
@@ -301,9 +302,9 @@ def test_linecollection_scaled_dashes():
301
302
lines1 = [[(0 , .5 ), (.5 , 1 )], [(.3 , .6 ), (.2 , .2 )]]
302
303
lines2 = [[[0.7 , .2 ], [.8 , .4 ]], [[.5 , .7 ], [.6 , .1 ]]]
303
304
lines3 = [[[0.6 , .2 ], [.8 , .4 ]], [[.5 , .7 ], [.1 , .1 ]]]
304
- lc1 = mc .LineCollection (lines1 , linestyles = "--" , lw = 3 )
305
- lc2 = mc .LineCollection (lines2 , linestyles = "-." )
306
- lc3 = mc .LineCollection (lines3 , linestyles = ":" , lw = .5 )
305
+ lc1 = mcollections .LineCollection (lines1 , linestyles = "--" , lw = 3 )
306
+ lc2 = mcollections .LineCollection (lines2 , linestyles = "-." )
307
+ lc3 = mcollections .LineCollection (lines3 , linestyles = ":" , lw = .5 )
307
308
308
309
fig , ax = plt .subplots ()
309
310
ax .add_collection (lc1 )
0 commit comments