8000 Fix ps export of colored hatches with no linewidth · matplotlib/matplotlib@9a11893 · GitHub
[go: up one dir, main page]

Skip to content

Commit 9a11893

Browse files
committed
Fix ps export of colored hatches with no linewidth
1 parent f1c3444 commit 9a11893

File tree

3 files changed

+230
-0
lines changed

3 files changed

+230
-0
lines changed

lib/matplotlib/backends/backend_ps.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -778,6 +778,7 @@ def _draw_ps(self, ps, gc, rgbFace, *, fill=True, stroke=True):
778778
self.set_linejoin(gc.get_joinstyle())
779779
self.set_linecap(gc.get_capstyle())
780780
self.set_linedash(*gc.get_dashes())
781+
if mightstroke or hatch:
781782
self.set_color(*gc.get_rgb()[:3])
782783
write('gsave\n')
783784

lib/matplotlib/tests/baseline_images/test_backend_ps/coloredhatcheszerolw.eps

Expand all lines: lib/matplotlib/tests/baseline_images/test_backend_ps/coloredhatcheszerolw.eps
Lines changed: 216 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/matplotlib/tests/test_backend_ps.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from matplotlib import cbook, patheffects
1010
from matplotlib._api import MatplotlibDeprecationWarning
1111
from matplotlib.figure import Figure
12+
from matplotlib.patches import Ellipse
1213
from matplotlib.testing.decorators import check_figures_equal, image_comparison
1314
import matplotlib as mpl
1415
import matplotlib.pyplot as plt
@@ -192,6 +193,18 @@ def test_type3_font():
192193
plt.figtext(.5, .5, "I/J")
193194

194195

196+
@image_comparison(["coloredhatcheszerolw.eps"])
197+
def test_colored_hatch_zero_linewidth():
198+
ax = plt.gca()
199+
ax.add_patch(Ellipse((0, 0), 1, 1, hatch='/', facecolor='none',
200+
edgecolor='r', linewidth=0))
201+
ax.add_patch(Ellipse((0.5, 0.5), 0.5, 0.5, hatch='+', facecolor='none',
202+
edgecolor='g', linewidth=0.2))
203+
ax.add_patch(Ellipse((1, 1), 0.3, 0.8, hatch='\\', facecolor='none',
204+
edgecolor='b', linewidth=0))
205+
ax.set_axis_off()
206+
207+
195208
@check_figures_equal(extensions=["eps"])
196209
def test_text_clip(fig_test, fig_ref):
197210
ax = fig_test.add_subplot()

0 commit comments

Comments
 (0)
0