Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fe6da77

Browse files
committed
Merge pull request #5217 from mdboom/xkcd-broken
Fix: PathEffect rendering on some backends
2 parents 1edc210 + 1f14776 commit fe6da77

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

lib/matplotlib/patheffects.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,9 @@ def __init__(self, path_effects, renderer):
9898
self._path_effects = path_effects
9999
self._renderer = renderer
100100

101+
def new_gc(self):
102+
return self._renderer.new_gc()
103+
101104
def copy_with_path_effect(self, path_effects):
102105
return self.__class__(path_effects, self._renderer)
103106

lib/matplotlib/tests/test_backend_ps.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
import matplotlib
1212
import matplotlib.pyplot as plt
13+
from matplotlib import patheffects
1314
from matplotlib.testing.decorators import cleanup, knownfailureif
1415

1516

@@ -120,6 +121,17 @@ def test_composite_image():
120121
assert buff.count(six.b(' colorimage')) == 2
121122

122123

124+
@cleanup
125+
def test_patheffects():
126+
with matplotlib.rc_context():
127+
matplotlib.rcParams['path.effects'] = [
128+
patheffects.withStroke(linewidth=4, foreground='w')]
129+
fig, ax = plt.subplots()
130+
ax.plot([1, 2, 3])
131+
with io.BytesIO() as ps:
132+
fig.savefig(ps, format='ps')
133+
134+
123135
if __name__ == '__main__':
124136
import nose
125137
nose.runmodule(argv=['-s', '--with-doctest'], exit=False)

0 commit comments

Comments
 (0)