File tree 2 files changed +13
-0
lines changed
2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -499,3 +499,15 @@ def test_text_repr():
499
499
plt .plot (['A' , 'B' ], [1 , 2 ])
500
500
txt = plt .text (['A' ], 0.5 , 'Boo' )
501
501
print (txt )
502
+
503
+
504
+ def test_annotation_update ():
505
+ fig , ax = plt .subplots (1 , 1 )
506
+ an = ax .annotate ('annotation' , xy = (0.5 , 0.5 ))
507
+ extent1 = an .get_window_extent (fig .canvas .get_renderer ())
508
+ fig .tight_layout ()
509
+ extent2 = an .get_window_extent (fig .canvas .get_renderer ())
510
+
511
+ np .testing .assert_raises (AssertionError , np .testing .assert_allclose ,
512
+ extent1 .get_points (), extent2 .get_points (),
513
+ rtol = 1e-6 )
Original file line number Diff line number Diff line change @@ -2354,6 +2354,7 @@ def get_window_extent(self, renderer=None):
2354
2354
*dpi* used defaults to self.figure.dpi; the renderer dpi is
2355
2355
irrelevant.
2356
2356
'''
2357
+ self .update_positions (renderer )
2357
2358
if not self .get_visible ():
2358
2359
return Bbox .unit ()
2359
2360
You can’t perform that action at this time.
0 commit comments