8000 FIX: fix FancyArrowPatch linestyle by tacaswell · Pull Request #7253 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

FIX: fix FancyArrowPatch linestyle #7253

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 1 commit into from
Oct 12, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
8000
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions lib/matplotlib/patches.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,9 +372,8 @@ def set_linewidth(self, w):
self._linewidth = float(w)
# scale the dash pattern by the linewidth
offset, ls = self._us_dashes
self._dashes = mlines._scale_dashes(offset,
ls,
self._linewidth)[1]
self._dashoffset, self._dashes = mlines._scale_dashes(
offset, ls, self._linewidth)
self.stale = True

def set_lw(self, lw):
Expand Down Expand Up @@ -417,9 +416,8 @@ def set_linestyle(self, ls):
# get the unscalled dash pattern
offset, ls = self._us_dashes = mlines._get_dash_pattern(ls)
# scale the dash pattern by the linewidth
self._dashes = mlines._scale_dashes(offset,
ls,
self._linewidth)[1]
self._dashoffset, self._dashes = mlines._scale_dashes(
offset, ls, self._linewidth)
self.stale = True

def set_ls(self, ls):
Expand Down Expand Up @@ -4271,7 +4269,7 @@ def draw(self, renderer):
if self._edgecolor[3] == 0:
lw = 0
gc.set_linewidth(lw)
gc.set_linestyle(self._linestyle)
gc.set_dashes(self._dashoffset, self._dashes)

gc.set_antialiased(self._antialiased)
self._set_gc_clip(gc)
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 26 additions & 0 deletions lib/matplotlib/tests/test_arrow_patches.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,32 @@ def test_fancyarrow_dpi_cor_200dpi():
__prepare_fancyarrow_dpi_cor_test()


@image_comparison(baseline_images=['fancyarrow_dash'],
remove_text=True, extensions=['png'],
style='default')
def test_fancyarrow_dash():
from matplotlib.patches import FancyArrowPatch
fig, ax = plt.subplots()

e = FancyArrowPatch((0, 0), (0.5, 0.5),
arrowstyle='-|>',
connectionstyle='angle3,angleA=0,angleB=90',
mutation_scale=10.0,
linewidth=2,
linestyle='dashed',
color='k')

e2 = FancyArrowPatch((0, 0), (0.5, 0.5),
arrowstyle='-|>',
connectionstyle='angle3',
mutation_scale=10.0,
linewidth=2,
linestyle='dotted',
color='k')
ax.add_patch(e)
ax.add_patch(e2)


if __name__ == '__main__':
import nose
nose.runmodule(argv=['-s', '--with-doctest'], exit=False)
0