File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -886,3 +886,19 @@ def call(*args, **kwargs):
886
886
# Every string gets a miss for the first layouting (extents), then a hit
887
887
# when drawing, but "foo\nbar" gets two hits as it's drawn twice.
888
888
assert info .hits > info .misses
889
+
890
+
891
+ def test_annotate_offset_fontsize ():
892
+ # Test that offset_fontsize parameter works and uses accurate values
893
+ fig , ax = plt .subplots ()
894
+ text_coords = ['offset points' , 'offset fontsize' ]
895
+ # 10 points should be equal to 1 fontsize unit at fontsize=10
896
+ xy_text = [(10 , 10 ), (1 , 1 )]
897
+ anns = [ax .annotate ('test' , xy = (0.5 , 0.5 ),
898
+ xytext = xy_text [i ],
899
+ fontsize = '10' ,
900
+ xycoords = 'data' ,
901
+ textcoords = text_coords [i ]) for i in range (2 )]
902
+ points_coords , fontsize_coords = [ann .get_window_extent () for ann in anns ]
903
+ fig .canvas .draw ()
904
+ assert str (points_coords ) == str (fontsize_coords )
You can’t perform that action at this time.
0 commit comments