8000 Fix a crash when saving to PDF or SVG with contour hatching. by mdboom · Pull Request #891 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Fix a crash when saving to PDF or SVG with contour hatching. #891

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

Merged
merged 2 commits into from
May 27, 2012

Conversation

mdboom
Copy link
Member
@mdboom mdboom commented May 23, 2012

This was found building the docs -- generating the page for contourf_hatching.py


fig = plt.figure()
ax = fig.add_subplot(111)
cs = ax.contourf(x, y, z, hatches=['-', '/', '\\', '//'],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this trigger the exception your fixing? Might be worth making this a numpy array from the off?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What triggers the exception is having colors for the hatch that come from a collection or colormap -- in which case each rgb triple is a numpy array, not something hashable as was previously assumed by the PDF and SVG backends.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I should also note -- it doesn't make sense to convert to tuples outside of the backends because the Agg backend benefits from having the colors as a Numpy array.

@jkseppan
Copy link
Member

Looks good to me. Would it make sense to merge this to the v1.1.x maintenance branch?

@efiring
Copy link
Member
efiring commented May 26, 2012

The whole thing can't be, because contourf hatching is not in v1.1.x. So maybe the thing to do is split it, merge the backend changes into v1.1.x, merge that into master, and then merge the rest of this pull request into master. Or just leave it as-is and not worry about fixing this particular bug in 1.1.x.

@jkseppan
Copy link
Member

If there's no example where this crashes in v1.1.x, let's just merge into master.

jkseppan added a commit that referenced this pull request May 27, 2012
Fix a crash when saving to PDF or SVG with contour hatching.
@jkseppan jkseppan merged commit 23e335b into matplotlib:master May 27, 2012
@mdboom mdboom deleted the hatching_crash branch March 3, 2015 18:43
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

Successfully merging this pull request may close these issues.

4 participants
0