Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1df0f7e

Browse files
author
Adrien VINCENT
committed
Should fix broken unit tests 'polar_axes' and 'polar_coords' in test_axes
1 parent 92d47c0 commit 1df0f7e

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
@@ -2158,11 +2158,17 @@ def _update_position_xytext(self, renderer, xy_pixel):
21582158
" use 'headlength' to set the head length in points.")
21592159
headlength = d.pop('headlength', 12)
21602160

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

21672173
self.arrow_patch.set_arrowstyle('simple', **stylekw)
21682174

0 commit comments

Comments
 (0)