8000 Should fix broken unit tests 'polar_axes' and 'polar_coords' in test_… · matplotlib/matplotlib@6191dff · GitHub
[go: up one dir, main page]

Skip to content

Commit 6191dff

Browse files
Adrien VINCENTjenshnielsen
Adrien VINCENT
authored andcommitted
Should fix broken unit tests 'polar_axes' and 'polar_coords' in test_axes
1 parent 3088b35 commit 6191dff

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

lib/matplotlib/text.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2163,11 +2163,17 @@ def _update_position_xytext(self, renderer, xy_pixel):
21632163
" use 'headlength' to set the head length in points.")
21642164
headlength = d.pop('headlength', 12)
21652165

2166-
to_style = self.figure.dpi / (72 * ms)
2167-
2168-
stylekw = dict(head_length=headlength * to_style,
2169-
head_width=headwidth * to_style,
2170-
tail_width=width * to_style)
2166+
# Old way:
2167+
# ms_pix = renderer.points_to_pixels(ms)
2168+
# to_style = self.figure.dpi / (72 * ms_pix)
2169+
# NB: is there a reason to use self.figure.dpi / (72 * ms_pix)
2170+
# instead of renderer.points_to_pixels(1.) / ms_pix? Both
2171+
# should be equal to '1 / ms', shouldn't they (by the way)?
2172+
#
2173+
# New way: '* to_style' <- '/ ms' (ms is now still in pts here)
2174+
stylekw = dict(head_length=headlength / ms,
2175+
head_width=headwidth / ms,
2176+
tail_width=width / ms)
21712177

21722178
self.arrow_patch.set_arrowstyle('simple', **stylekw)
21732179

0 commit comments

Comments
 (0)
0