Skip to content

Commit

Permalink
Merge pull request #5217 from mdboom/xkcd-broken
Browse files Browse the repository at this point in the history
Fix: PathEffect rendering on some backends
  • Loading branch information
tacaswell committed Oct 9, 2015
1 parent b5d8674 commit ff2e4b9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/matplotlib/patheffects.py
Expand Up @@ -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)

Expand Down
12 changes: 12 additions & 0 deletions lib/matplotlib/tests/test_backend_ps.py
Expand Up @@ -10,6 +10,7 @@

import matplotlib
import matplotlib.pyplot as plt
from matplotlib import patheffects
from matplotlib.testing.decorators import cleanup, knownfailureif


Expand Down Expand Up @@ -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)

0 comments on commit ff2e4b9

Please sign in to comment.