Skip to content
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

invalid EPS figure in Mac OS X #3523

Closed
bryan-woods opened this issue Sep 16, 2014 · 14 comments
Closed

invalid EPS figure in Mac OS X #3523

bryan-woods opened this issue Sep 16, 2014 · 14 comments
Milestone

Comments

@bryan-woods
Copy link

I've upgraded to matplotlib 1.4.0 and am getting invalid EPS files (according to Preview) when I save figures that use

basemap (1.0.7). The same figure in PNG or PDF format works fine. I also saved a bar chart in EPS that worked.

I have verified that this happens in both OS X Mavericks and Mountain Lion. It doesn't matter whether I install using pip or homebrew. If I downgrade to matplotlib 1.3.1 it works fine.

Below is the code I was trying:

import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt 
import numpy as np
from mpl_toolkits.basemap import Basemap

plt.figure()
m = Basemap(projection='npstere',lon_0=-270.,boundinglat=30.,round=True)
m.drawcoastlines(linewidth=1)
m.drawmapboundary(linewidth=1)
m.fillcontinents(color='silver')
m.drawmeridians(np.arange(-360,1,60))
m.drawparallels(np.arange(30,90,30))

plt.savefig('test.eps')
plt.savefig('test.pdf')
plt.savefig('test.png')

[TAC edited for formatting]

@tacaswell
Copy link
Member

If you are using python3 I think this is a duplicate of #3494 .

@tacaswell tacaswell added this to the v1.4.x milestone Sep 16, 2014
@tacaswell
Copy link
Member

Or at least related as that other bug also happen is 1.3.1.

@bryan-woods
Copy link
Author

I am using python 2.7.8

@tacaswell
Copy link
Member

Can you post the corrupt file someplace?

@bryan-woods
Copy link
Author

Corrupt file: http://ge.tt/71cCd7x1/v/0

@tacaswell
Copy link
Member

I am back to this being a duplicate as the eps includes the line

/b'BitstreamVeraSans-Roman' findfont

Which I think should really be

/BitstreamVeraSans-Roman findfont

and this is the conversion to six causing a few more problems.

Can you check if the patch at https://github.com/matplotlib/matplotlib/pull/3496.diff fixes the problem for you?

@bryan-woods
Copy link
Author

No dice. The EPS is the same, except for the %%CreationDate

tacaswell added a commit to tacaswell/matplotlib that referenced this issue Sep 16, 2014
@tacaswell
Copy link
Member

ahh, I see, same problem,different place. How about with https://github.com/matplotlib/matplotlib/pull/3525.diff ? (I don't have a mac I can test on).

@bryan-woods
Copy link
Author

Still no change to the EPS.

@tacaswell
Copy link
Member

Sorry, I was on a wild-goose chase, I was looking at the wrong test.eps in my download directory....

@tacaswell tacaswell modified the milestones: v1.4.1, v1.4.x Sep 16, 2014
@tacaswell
Copy link
Member

The file has lines that look like this:

<built-in function id>

which the language reference manual seems to say is the syntax for putting in hex numbers (if I am reading it right) so I suspect something is going really wrong in the writer...

tacaswell added a commit to tacaswell/matplotlib that referenced this issue Sep 16, 2014
_get_clip_path was returning '<built-in function id>' instead
of the ps-function name like it should have been.  This was introduced
in 9b9c0c6 in PR matplotlib#2927.

Closes matplotlib#3523
@tacaswell
Copy link
Member

@bryan-woods Ok, lets try this again, have a look at https://github.com/matplotlib/matplotlib/pull/3526.diff

@bryan-woods
Copy link
Author

That's the winner!

@tacaswell
Copy link
Member

Great! I would like to keep this issue open until that PR gets merged, it helps with tracking what still needs to be done.

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

2 participants