@@ -174,7 +174,7 @@ def test_contains():
174174
175175 # draw the text. This is important, as the contains method can only work
176176 # when a renderer exists.
177- plt .draw ()
177+ fig . canvas .draw ()
178178
179179 for x , y in zip (xs .flat , ys .flat ):
180180 mevent .x , mevent .y = plt .gca ().transAxes .transform_point ([x , y ])
@@ -238,12 +238,12 @@ def test_set_position():
238238 # test set_position
239239 ann = ax .annotate (
240240 'test' , (0 , 0 ), xytext = (0 , 0 ), textcoords = 'figure pixels' )
241- plt .draw ()
241+ fig . canvas .draw ()
242242
243243 init_pos = ann .get_window_extent (fig .canvas .renderer )
244244 shift_val = 15
245245 ann .set_position ((shift_val , shift_val ))
246- plt .draw ()
246+ fig . canvas .draw ()
247247 post_pos = ann .get_window_extent (fig .canvas .renderer )
248248
249249 for a , b in zip (init_pos .min , post_pos .min ):
@@ -252,12 +252,12 @@ def test_set_position():
252252 # test xyann
253253 ann = ax .annotate (
254254 'test' , (0 , 0 ), xytext = (0 , 0 ), textcoords = 'figure pixels' )
255- plt .draw ()
255+ fig . canvas .draw ()
256256
257257 init_pos = ann .get_window_extent (fig .canvas .renderer )
258258 shift_val = 15
259259 ann .xyann = (shift_val , shift_val )
260- plt .draw ()
260+ fig . canvas .draw ()
261261 post_pos = ann .get_window_extent (fig .canvas .renderer )
262262
263263 for a , b in zip (init_pos .min , post_pos .min ):
@@ -396,7 +396,6 @@ def test_agg_text_clip():
396396 for x , y in np .random .rand (10 , 2 ):
397397 ax1 .text (x , y , "foo" , clip_on = True )
398398 ax2 .text (x , y , "foo" )
399- plt .show ()
400399
401400
402401def test_text_size_binding ():
0 commit comments