@@ -205,6 +205,7 @@ def test_image_alpha():
205205 plt .subplot (133 )
206206 plt .imshow (Z , alpha = 0.5 , interpolation = 'nearest' )
207207
208+
208209def test_cursor_data ():
209210 from matplotlib .backend_bases import MouseEvent
210211
@@ -286,7 +287,8 @@ def test_image_cliprect():
286287
287288 im = ax .imshow (d , extent = (0 ,5 ,0 ,5 ))
288289
289- rect = patches .Rectangle (xy = (1 ,1 ), width = 2 , height = 2 , transform = im .axes .transData )
290+ rect = patches .Rectangle (
291+ xy = (1 ,1 ), width = 2 , height = 2 , transform = im .axes .transData )
290292 im .set_clip_path (rect )
291293
292294
@@ -302,23 +304,20 @@ def test_imshow():
302304@image_comparison (baseline_images = ['no_interpolation_origin' ],
303305 remove_text = True )
304306def test_no_interpolation_origin ():
305- fig = plt .figure ()
306- ax = fig .add_subplot (211 )
307- ax .imshow (np .arange (100 ).reshape ((2 , 50 )), origin = "lower" ,
308- interpolation = 'none' )
309-
310- ax = fig .add_subplot (212 )
311- ax .imshow (np .arange (100 ).reshape ((2 , 50 )), interpolation = 'none' )
307+ fig , axs = plt .subplots (2 )
308+ axs [0 ].imshow (np .arange (100 ).reshape ((2 , 50 )), origin = "lower" ,
309+ interpolation = 'none' )
310+ axs [1 ].imshow (np .arange (100 ).reshape ((2 , 50 )), interpolation = 'none' )
312311
313312
314313@image_comparison (baseline_images = ['image_shift' ], remove_text = True ,
315314 extensions = ['pdf' , 'svg' ])
316315def test_image_shift ():
317316 from matplotlib .colors import LogNorm
318317
319- imgData = [[1.0 / ( x ) + 1.0 / ( y ) for x in range (1 ,100 )] for y in range (1 ,100 )]
320- tMin = 734717.945208
321- tMax = 734717.946366
318+ imgData = [[1 / x + 1 / y for x in range (1 , 100 )] for y in range (1 , 100 )]
319+ tMin = 734717.945208
320+ tMax = 734717.946366
322321
323322 fig , ax = plt .subplots ()
324323 ax .imshow (imgData , norm = LogNorm (), interpolation = 'none' ,
@@ -376,11 +375,13 @@ def test_image_composite_alpha():
376375 fig , ax = plt .subplots ()
377376 arr = np .zeros ((11 , 21 , 4 ))
378377 arr [:, :, 0 ] = 1
379- arr [:, :, 3 ] = np .concatenate ((np .arange (0 , 1.1 , 0.1 ), np .arange (0 , 1 , 0.1 )[::- 1 ]))
378+ arr [:, :, 3 ] = np .concatenate (
379+ (np .arange (0 , 1.1 , 0.1 ), np .arange (0 , 1 , 0.1 )[::- 1 ]))
380380 arr2 = np .zeros ((21 , 11 , 4 ))
381381 arr2 [:, :, 0 ] = 1
382382 arr2 [:, :, 1 ] = 1
383- arr2 [:, :, 3 ] = np .concatenate ((np .arange (0 , 1.1 , 0.1 ), np .arange (0 , 1 , 0.1 )[::- 1 ]))[:, np .newaxis ]
383+ arr2 [:, :, 3 ] = np .concatenate (
384+ (np .arange (0 , 1.1 , 0.1 ), np .arange (0 , 1 , 0.1 )[::- 1 ]))[:, np .newaxis ]
384385 ax .imshow (arr , extent = [1 , 2 , 5 , 0 ], alpha = 0.3 )
385386 ax .imshow (arr , extent = [2 , 3 , 5 , 0 ], alpha = 0.6 )
386387 ax .imshow (arr , extent = [3 , 4 , 5 , 0 ])
@@ -397,21 +398,22 @@ def test_image_composite_alpha():
397398 remove_text = True , style = 'mpl20' )
398399def test_rasterize_dpi ():
399400 # This test should check rasterized rendering with high output resolution.
400- # It plots a rasterized line and a normal image with implot. So it will catch
401- # when images end up in the wrong place in case of non-standard dpi setting.
402- # Instead of high-res rasterization i use low-res. Therefore the fact that the
403- # resolution is non-standard is easily checked by image_comparison.
401+ # It plots a rasterized line and a normal image with implot. So it will
402+ # catch when images end up in the wrong place in case of non-standard dpi
403+ # setting. Instead of high-res rasterization I use low-res. Therefore
404+ # the fact that the resolution is non-standard is easily checked by
405+ # image_comparison.
404406 img = np .asarray ([[1 , 2 ], [3 , 4 ]])
405407
406- fig , axes = plt .subplots (1 , 3 , figsize = (3 , 1 ))
408+ fig , axes = plt .subplots (1 , 3 , figsize = (3 , 1 ))
407409
408410 axes [0 ].imshow (img )
409411
410- axes [1 ].plot ([0 ,1 ],[0 ,1 ], linewidth = 20. , rasterized = True )
411- axes [1 ].set (xlim = (0 ,1 ), ylim = (- 1 , 2 ))
412+ axes [1 ].plot ([0 ,1 ], [0 ,1 ], linewidth = 20. , rasterized = True )
413+ axes [1 ].set (xlim = (0 , 1 ), ylim = (- 1 , 2 ))
412414
413- axes [2 ].plot ([0 ,1 ],[0 ,1 ], linewidth = 20. )
414- axes [2 ].set (xlim = (0 ,1 ), ylim = (- 1 , 2 ))
415+ axes [2 ].plot ([0 ,1 ], [0 ,1 ], linewidth = 20. )
416+ axes [2 ].set (xlim = (0 , 1 ), ylim = (- 1 , 2 ))
415417
416418 # Low-dpi PDF rasterization errors prevent proper image comparison tests.
417419 # Hide detailed structures like the axes spines.
@@ -441,8 +443,8 @@ def test_bbox_image_inverted():
441443
442444 image = np .identity (10 )
443445
444- bbox_im = BboxImage (
445- TransformedBbox ( Bbox ([[ 0.1 , 0.2 ], [ 0.3 , 0.25 ]]), ax .figure .transFigure ))
446+ bbox_im = BboxImage (TransformedBbox ( Bbox ([[ 0.1 , 0.2 ], [ 0.3 , 0.25 ]]),
447+ ax .figure .transFigure ))
446448 bbox_im .set_data (image )
447449 bbox_im .set_clip_on (False )
448450 ax .add_artist (bbox_im )
@@ -459,7 +461,8 @@ def test_get_window_extent_for_AxisImage():
459461 ax .set_position ([0 , 0 , 1 , 1 ])
460462 ax .set_xlim (0 , 1 )
461463 ax .set_ylim (0 , 1 )
462- im_obj = ax .imshow (im , extent = [0.4 , 0.7 , 0.2 , 0.9 ], interpolation = 'nearest' )
464+ im_obj = ax .imshow (
465+ im , extent = [0.4 , 0.7 , 0.2 , 0.9 ], interpolation = 'nearest' )
463466
464467 fig .canvas .draw ()
465468 renderer = fig .canvas .renderer
0 commit comments