@@ -148,21 +148,15 @@ def generate_imshow_demo_grid(extents, xlim=None, ylim=None):
148148 for ax , extent in zip (columns [origin ], extents ):
149149 plot_imshow_with_labels (ax , data , extent , origin , xlim , ylim )
150150
151+ columns ['label' ][0 ].set_title ('extent=' )
151152 for ax , extent in zip (columns ['label' ], extents ):
152- text_kwargs = {'ha' : 'right' ,
153- 'va' : 'center' ,
154- 'xycoords' : 'axes fraction' ,
155- 'xy' : (1 , .5 )}
156153 if extent is None :
157- ax .annotate ('None' , ** text_kwargs )
158- ax .set_title ('extent=' )
154+ text = 'None'
159155 else :
160156 left , right , bottom , top = extent
161- text = ('left: {left:0.1f}\n right: {right:0.1f}\n ' +
162- 'bottom: {bottom:0.1f}\n top: {top:0.1f}\n ' ).format (
163- left = left , right = right , bottom = bottom , top = top )
164-
165- ax .annotate (text , ** text_kwargs )
157+ text = (f'left: { left :0.1f} \n right: { right :0.1f} \n '
158+ f'bottom: { bottom :0.1f} \n top: { top :0.1f} \n ' )
159+ ax .text (1. , .5 , text , transform = ax .transAxes , ha = 'right' , va = 'center' )
166160 ax .axis ('off' )
167161 return columns
168162
@@ -263,3 +257,5 @@ def generate_imshow_demo_grid(extents, xlim=None, ylim=None):
263257
264258generate_imshow_demo_grid (extents = [None ] + extents ,
265259 xlim = (- 2 , 8 ), ylim = (- 1 , 6 ))
260+
261+ plt .show ()
0 commit comments