Skip to content

Fix eps hatching in MacOS Preview #15064

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 1 commit into from
Aug 19, 2019

Conversation

mkvoya
Copy link
Contributor

@mkvoya mkvoya commented Aug 15, 2019

PR Summary

Hatching in EPS figures doesn't show up in Preview on MacOS X as reported in #8289.
This PR fixes the problem.

PR Checklist

  • Has Pytest style unit tests
  • Code is Flake 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

@jklymak
Copy link
Member

jklymak commented Aug 15, 2019

Looks good. Do we having hatching tests?

@QuLogic
Copy link
Member

QuLogic commented Aug 15, 2019

We do, but I don't think any of them check (e)ps output.

@tacaswell tacaswell added this to the v3.2.0 milestone Aug 16, 2019
@tacaswell
Copy link
Member

Does this still break #6228 ?

@mkvoya
Copy link
Contributor Author

mkvoya commented Aug 16, 2019

Does this still break #6228 ?

I don't think this breaks #6228.
The example program gives me the same results (as in the discussion) before and after this patch.
Though the results look strange.


)

@mkvoya
Copy link
Contributor Author

mkvoya commented Aug 16, 2019

Also, it would be better if someone else can confirm the results, since I only tried this on my own laptop.

@czeni
Copy link

czeni commented Aug 16, 2019

Some clarification to this path from my side. When I plotted with hatching in PyCharm, its own viewer
hatched bar plots correctly. But when I opened the eps file directly on ubuntu (and windows too), or included in a Latex file, the hatches disappeared.

@mkvoya
Copy link
Contributor Author

mkvoya commented Aug 17, 2019

Some clarification to this path from my side. When I plotted with hatching in PyCharm, its own viewer
hatched bar plots correctly. But when I opened the eps file directly on ubuntu (and windows too), or included in a Latex file, the hatches disappeared.

I tried this myself using a newly installed Ubuntu 19.04 virtual machine.
The Document Viewer shows the eps correctly.

image

The EPS file is generated by MacOS (in the fish shell, rather than PyCharm) and transferred to the VM.
The script to generate EPS is as follows.

from matplotlib import pyplot as plt
from matplotlib.patches import Ellipse

fig = plt.figure()
ax = fig.add_subplot(1,1,1)
ell = Ellipse((0.5, 0.5), 0.3, 0.4, 30, fill=False, hatch='/', facecolor='red', edgecolor='black')
ax.add_patch(ell)
fig.savefig('test.eps')

The EPS file is shown correctly in Win10 by an app called Pictures Opener.
image

So, would you please provide more details about your situation?

Copy link
Contributor

@anntzer anntzer left a comment

Choose a reason for hiding this comment

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

I can't test on OSX, but this seems right (and thus ghostscript buggy? dunno) -- fill should clear the current path, so we need to save it with gsave/grestore to keep it available for stroke.

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

Successfully merging this pull request may close these issues.

6 participants