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

Skip to content

Patch issue 6035 rebase #6504

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
May 30, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Achieve DPI-independent arrow heads in a cleaner way
  • Loading branch information
afvincent authored and jenshnielsen committed May 30, 2016
commit f0eda1f4147b5984af9512daf9ff063b575da9fc
26 changes: 11 additions & 15 deletions lib/matplotlib/patches.py
Original file line number Diff line number Diff line change
Expand Up @@ -4056,23 +4056,19 @@ def __init__(self, posA=None, posB=None,

self._mutation_scale = mutation_scale
self._mutation_aspect = mutation_aspect
# Provide a ref. to scale '_mutation_scale' when setting '_dpi_cor'.
self._genuine_mutation_scale = mutation_scale


self.set_dpi_cor(dpi_cor)
#self._draw_in_display_coordinate = True

def set_dpi_cor(self, dpi_cor):
"""
dpi_cor is currently used for linewidth-related things and
shrink factor. Mutation scale *is* affected by this.
shrink factor. Mutation scale is not affected by this.
"""

self._dpi_cor = dpi_cor
self.stale = True
# Scale `_mutation_scale` properly with the new DPI (see issue #6035).
self._mutation_scale = self._genuine_mutation_scale * dpi_cor


def get_dpi_cor(self):
"""
dpi_cor is currently used for linewidth-related things and
Expand Down Expand Up @@ -4233,10 +4229,10 @@ def get_path_in_displaycoord(self):
_path = self.get_transform().transform_path(self._path_original)

_path, fillable = self.get_arrowstyle()(_path,
self.get_mutation_scale(),
self.get_linewidth() * dpi_cor,
self.get_mutation_aspect()
)
self.get_mutation_scale() * dpi_cor,
self.get_linewidth() * dpi_cor,
self.get_mutation_aspect()
)

#if not fillable:
# self._fill = False
Expand Down Expand Up @@ -4549,10 +4545,10 @@ def get_path_in_displaycoord(self):
)

_path, fillable = self.get_arrowstyle()(_path,
self.get_mutation_scale(),
self.get_linewidth() * dpi_cor,
self.get_mutation_aspect()
)
self.get_mutation_scale() * dpi_cor,
self.get_linewidth() * dpi_cor,
self.get_mutation_aspect()
)

return _path, fillable

Expand Down
1 change: 0 additions & 1 deletion lib/matplotlib/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -2147,7 +2147,6 @@ def _update_position_xytext(self, renderer, xy_pixel):

d = self.arrowprops.copy()
ms = d.pop("mutation_scale", self.get_size())
ms = renderer.points_to_pixels(ms)
self.arrow_patch.set_mutation_scale(ms)

if "arrowstyle" not in d:
Expand Down