diff --git a/lib/matplotlib/patches.py b/lib/matplotlib/patches.py index 022821f8bd8f..e212552465dc 100644 --- a/lib/matplotlib/patches.py +++ b/lib/matplotlib/patches.py @@ -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): @@ -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): @@ -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) diff --git a/lib/matplotlib/tests/baseline_images/test_arrow_patches/fancyarrow_dash.png b/lib/matplotlib/tests/baseline_images/test_arrow_patches/fancyarrow_dash.png new file mode 100644 index 000000000000..1b1337af06a5 Binary files /dev/null and b/lib/matplotlib/tests/baseline_images/test_arrow_patches/fancyarrow_dash.png differ diff --git a/lib/matplotlib/tests/test_arrow_patches.py b/lib/matplotlib/tests/test_arrow_patches.py index 16b473e957ef..466a53b87f82 100644 --- a/lib/matplotlib/tests/test_arrow_patches.py +++ b/lib/matplotlib/tests/test_arrow_patches.py @@ -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)