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

Skip to content

Commit f0eda1f

Browse files
afvincentjenshnielsen
authored andcommitted
Achieve DPI-independent arrow heads in a cleaner way
1 parent d1fddc7 commit f0eda1f

File tree

2 files changed

+11
-16
lines changed

2 files changed

+11
-16
lines changed

lib/matplotlib/patches.py

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4056,23 +4056,19 @@ def __init__(self, posA=None, posB=None,
40564056

40574057
self._mutation_scale = mutation_scale
40584058
self._mutation_aspect = mutation_aspect
4059-
# Provide a ref. to scale '_mutation_scale' when setting '_dpi_cor'.
4060-
self._genuine_mutation_scale = mutation_scale
4061-
4059+
40624060
self.set_dpi_cor(dpi_cor)
40634061
#self._draw_in_display_coordinate = True
40644062

40654063
def set_dpi_cor(self, dpi_cor):
40664064
"""
40674065
dpi_cor is currently used for linewidth-related things and
4068-
shrink factor. Mutation scale *is* affected by this.
4066+
shrink factor. Mutation scale is not affected by this.
40694067
"""
40704068

40714069
self._dpi_cor = dpi_cor
40724070
self.stale = True
4073-
# Scale `_mutation_scale` properly with the new DPI (see issue #6035).
4074-
self._mutation_scale = self._genuine_mutation_scale * dpi_cor
4075-
4071+
40764072
def get_dpi_cor(self):
40774073
"""
40784074
dpi_cor is currently used for linewidth-related things and
@@ -4233,10 +4229,10 @@ def get_path_in_displaycoord(self):
42334229
_path = self.get_transform().transform_path(self._path_original)
42344230

42354231
_path, fillable = self.get_arrowstyle()(_path,
4236-
self.get_mutation_scale(),
4237-
self.get_linewidth() * dpi_cor,
4238-
self.get_mutation_aspect()
4239-
)
4232+
self.get_mutation_scale() * dpi_cor,
4233+
self.get_linewidth() * dpi_cor,
4234+
self.get_mutation_aspect()
4235+
)
42404236

42414237
#if not fillable:
42424238
# self._fill = False
@@ -4549,10 +4545,10 @@ def get_path_in_displaycoord(self):
45494545
)
45504546

45514547
_path, fillable = self.get_arrowstyle()(_path,
4552-
self.get_mutation_scale(),
4553-
self.get_linewidth() * dpi_cor,
4554-
self.get_mutation_aspect()
4555-
)
4548+
self.get_mutation_scale() * dpi_cor,
4549+
self.get_linewidth() * dpi_cor,
4550+
self.get_mutation_aspect()
4551+
)
45564552

45574553
return _path, fillable
45584554

lib/matplotlib/text.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2147,7 +2147,6 @@ def _update_position_xytext(self, renderer, xy_pixel):
21472147

21482148
d = self.arrowprops.copy()
21492149
ms = d.pop("mutation_scale", self.get_size())
2150-
ms = renderer.points_to_pixels(ms)
21512150
self.arrow_patch.set_mutation_scale(ms)
21522151

21532152
if "arrowstyle" not in d:

0 commit comments

Comments
 (0)