Closed
Description
This may have some similarities with #7992, but seems not identical to other bug reports I found.
Bug report
Bug summary
- It is no longer possible to set the color of hatching in patches. This still worked in 1.5.3-.
- In particular, it affects PathPatch for me, but seems a more general problem.
Code for reproduction
An example modified from http://matplotlib.org/users/path_tutorial.html is
import matplotlib.pyplot as plt
from matplotlib.path import Path
import matplotlib.patches as patches
verts = [
(0., 0.), # left, bottom
(0., 1.), # left, top
(1., 1.), # right, top
(1., 0.), # right, bottom
(0., 0.), # ignored
]
codes = [Path.MOVETO,
Path.LINETO,
Path.LINETO,
Path.LINETO,
Path.CLOSEPOLY,
]
path = Path(verts, codes)
fig = plt.figure()
ax = fig.add_subplot(111)
patch = patches.PathPatch(path, color='green', fill=False, hatch='xx', lw=2)
ax.add_patch(patch)
ax.set_xlim(-2,2)
ax.set_ylim(-2,2)
plt.show()
Actual outcome
green rectangle filled with black cross hatching on white background.
Expected outcome
green rectangle filled with (more dense) green cross hatching on white background.
(Matplotlib 1.5.3-)
Matplotlib version
Python 3.6.0
IPython 5.2.2
Matplotlib 2.0.0
You should add a unit test for this.
Other examples
- An example of a similar problem can be found if you try to reproduce the plot at
http://stackoverflow.com/questions/38168948/how-to-decouple-hatch-and-edge-color-in-matplotlib
using their code.
Metadata
Metadata
Assignees
Labels
No labels