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
Docstring/comments fixes & PEP8.
  • Loading branch information
afvincent authored and jenshnielsen committed May 30, 2016
commit d3af67dfbe5411f79c048103fab697ed01611605
14 changes: 8 additions & 6 deletions lib/matplotlib/patches.py
Original file line number Diff line number Diff line change
Expand Up @@ -4072,7 +4072,7 @@ def set_dpi_cor(self, dpi_cor):
def get_dpi_cor(self):
"""
dpi_cor is currently used for linewidth-related things and
shrink factor. Mutation scale *is now* affected by this.
shrink factor. Mutation scale is affected by this.
"""

return self._dpi_cor
Expand Down Expand Up @@ -4224,11 +4224,12 @@ def get_path_in_displaycoord(self):
patchB=self.patchB,
shrinkA=self.shrinkA * dpi_cor,
shrinkB=self.shrinkB * dpi_cor
)
)
else:
_path = self.get_transform().transform_path(self._path_original)

_path, fillable = self.get_arrowstyle()(_path,
_path, fillable = self.get_arrowstyle()(
_path,
self.get_mutation_scale() * dpi_cor,
self.get_linewidth() * dpi_cor,
self.get_mutation_aspect()
Expand Down Expand Up @@ -4542,13 +4543,14 @@ def get_path_in_displaycoord(self):
patchB=self.patchB,
shrinkA=self.shrinkA * dpi_cor,
shrinkB=self.shrinkB * dpi_cor
)
)

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

return _path, fillable

Expand Down
6 changes: 3 additions & 3 deletions lib/matplotlib/tests/test_arrow_patches.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import matplotlib.pyplot as plt
from matplotlib.testing.decorators import image_comparison
import matplotlib.patches as mpatches # adopting scipy import conventions
import matplotlib.patches as mpatches


def draw_arrow(ax, t, r):
Expand Down Expand Up @@ -54,7 +54,7 @@ def test_boxarrow():

def prepare_fancyarrow_dpi_cor_test():
"""
Convenience function that prepares and return a FancyArrowPatch. It aims
Convenience function that prepares and returns a FancyArrowPatch. It aims
at being used to test that the size of the arrow head does not depend on
the DPI value of the exported picture.

Expand All @@ -76,7 +76,7 @@ def prepare_fancyarrow_dpi_cor_test():
def test_fancyarrow_dpi_cor_100dpi():
"""
Check the export of a FancyArrowPatch @ 100 DPI. FancyArrowPatch is
instanciated through a dedicated function because another similar test
instantiated through a dedicated function because another similar test
checks a similar export but with a different DPI value.

Remark: test only a rasterized format.
Expand Down
9 changes: 1 addition & 8 deletions lib/matplotlib/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -2163,14 +2163,7 @@ def _update_position_xytext(self, renderer, xy_pixel):
" use 'headlength' to set the head length in points.")
headlength = d.pop('headlength', 12)

# Old way:
# ms_pix = renderer.points_to_pixels(ms)
# to_style = self.figure.dpi / (72 * ms_pix)
# NB: is there a reason to use self.figure.dpi / (72 * ms_pix)
# instead of renderer.points_to_pixels(1.) / ms_pix? Both
# should be equal to '1 / ms', shouldn't they (by the way)?
#
# New way: '* to_style' <- '/ ms' (ms is now still in pts here)
# NB: ms is in pts
stylekw = dict(head_length=headlength / ms,
head_width=headwidth / ms,
tail_width=width / ms)
Expand Down