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

Skip to content

Matplotlib hatch color broken #8076

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
2sn opened this issue Feb 15, 2017 · 7 comments
Closed

Matplotlib hatch color broken #8076

2sn opened this issue Feb 15, 2017 · 7 comments
Milestone

Comments

@2sn
Copy link

2sn commented Feb 15, 2017

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

@dstansby
Copy link
Member

Thanks for the easy to copy-and-paste example! Running it on our current 2.0.x branch, I get the image below; is that what you were expecting?
figure_1

@2sn
Copy link
Author

2sn commented Feb 15, 2017

Thank you for the very fast reply.

Yes, this is what it should look like. The version you were using not yet the current version on PyPi that I can install using pip, I assume; is this current version on the devel branch from git?

@dstansby
Copy link
Member

Yep, that's right. The branch I used is the current bugfix branch for 2.0, so the bug will be fixed when 2.0.1 is released.

@dstansby dstansby added this to the 2.0.1 (next bug fix release) milestone Feb 15, 2017
@dopplershift
Copy link
Contributor

I think this was fixed by #7976 .

@2sn
Copy link
Author

2sn commented Mar 26, 2017

Is there any ETA when version 2.0.1 may be released?
It seems there is many fixes that have run up ... you don't have to catch them all at once, it does not have to be perfect, it never will be, you can always release a version 2.0.2 to fix more issues, ...
For most of my collaborators wanting to use my packages and don't want to compile their own matplotlib version from git, the only really easy solution around for now is to revert back to 1.6.3, which is not really what we want ...

@bastibl
Copy link

bastibl commented Apr 11, 2017

The bugfix branch also seems to have some problems. While it draws the patch correctly (as above), legends still use black hatches (i.e. don't match the patch).

@dstansby
Copy link
Member

Would it be possible to open a new issue with a minimal example that demonstrates broken hatches on legends?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants