diff --git a/lib/matplotlib/patheffects.py b/lib/matplotlib/patheffects.py index 65b98ae19be5..5435bcc8bd00 100644 --- a/lib/matplotlib/patheffects.py +++ b/lib/matplotlib/patheffects.py @@ -98,6 +98,9 @@ def __init__(self, path_effects, renderer): self._path_effects = path_effects self._renderer = renderer + def new_gc(self): + return self._renderer.new_gc() + def copy_with_path_effect(self, path_effects): return self.__class__(path_effects, self._renderer) diff --git a/lib/matplotlib/tests/test_backend_ps.py b/lib/matplotlib/tests/test_backend_ps.py index c01395c96d7f..ab346a4d0a41 100644 --- a/lib/matplotlib/tests/test_backend_ps.py +++ b/lib/matplotlib/tests/test_backend_ps.py @@ -10,6 +10,7 @@ import matplotlib import matplotlib.pyplot as plt +from matplotlib import patheffects from matplotlib.testing.decorators import cleanup, knownfailureif @@ -120,6 +121,17 @@ def test_composite_image(): assert buff.count(six.b(' colorimage')) == 2 +@cleanup +def test_patheffects(): + with matplotlib.rc_context(): + matplotlib.rcParams['path.effects'] = [ + patheffects.withStroke(linewidth=4, foreground='w')] + fig, ax = plt.subplots() + ax.plot([1, 2, 3]) + with io.BytesIO() as ps: + fig.savefig(ps, format='ps') + + if __name__ == '__main__': import nose nose.runmodule(argv=['-s', '--with-doctest'], exit=False)