@@ -148,21 +148,15 @@ def generate_imshow_demo_grid(extents, xlim=None, ylim=None):
148
148
for ax , extent in zip (columns [origin ], extents ):
149
149
plot_imshow_with_labels (ax , data , extent , origin , xlim , ylim )
150
150
151
+ columns ['label' ][0 ].set_title ('extent=' )
151
152
for ax , extent in zip (columns ['label' ], extents ):
152
- text_kwargs = {'ha' : 'right' ,
153
- 'va' : 'center' ,
154
- 'xycoords' : 'axes fraction' ,
155
- 'xy' : (1 , .5 )}
156
153
if extent is None :
157
- ax .annotate ('None' , ** text_kwargs )
158
- ax .set_title ('extent=' )
154
+ text = 'None'
159
155
else :
160
156
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' )
166
160
ax .axis ('off' )
167
161
return columns
168
162
@@ -263,3 +257,5 @@ def generate_imshow_demo_grid(extents, xlim=None, ylim=None):
263
257
264
258
generate_imshow_demo_grid (extents = [None ] + extents ,
265
259
xlim = (- 2 , 8 ), ylim = (- 1 , 6 ))
260
+
261
+ plt .show ()
0 commit comments