Skip to content

Fix eps hatching in MacOS Preview - #15064

Merged
tacaswell merged 1 commit into
matplotlib:masterfrom
mkvoya:fix-macos-preview-eps-hatching
Aug 19, 2019
Merged

tacaswell merged 1 commit into
matplotlib:masterfrom
mkvoya:fix-macos-preview-eps-hatching

Conversation

@mkvoya

@mkvoya mkvoya commented Aug 15, 2019 •

Copy link
Copy Markdown
Contributor

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

jklymak commented Aug 15, 2019

Copy link
Copy Markdown
Member

Looks good. Do we having hatching tests?

@QuLogic

QuLogic commented Aug 15, 2019

Copy link
Copy Markdown
Member

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
Copy Markdown
Member

Does this still break #6228 ?

@mkvoya

mkvoya commented Aug 16, 2019

Copy link
Copy Markdown
Contributor Author

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

mkvoya commented Aug 16, 2019

Copy link
Copy Markdown
Contributor Author

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

@czeni

czeni commented Aug 16, 2019

Copy link
Copy Markdown

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

mkvoya commented Aug 17, 2019

Copy link
Copy Markdown
Contributor Author

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?

@anntzer anntzer left a comment

Copy link
Copy Markdown
Contributor

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