Skip to content

invalid EPS figure in Mac OS X #3523

Closed
Closed

Description

@bryan-woods

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]

Activity

  1. tacaswell commented on Sep 16, 2014

    @tacaswell
    Member

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

  2. added this to the v1.4.x milestone on Sep 16, 2014
  3. tacaswell commented on Sep 16, 2014

    @tacaswell
    Member

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

  4. bryan-woods commented on Sep 16, 2014

    @bryan-woods
    Author

    I am using python 2.7.8

  5. tacaswell commented on Sep 16, 2014

    @tacaswell
    Member

    Can you post the corrupt file someplace?

  6. bryan-woods commented on Sep 16, 2014

    @bryan-woods
    Author
  7. tacaswell commented on Sep 16, 2014

    @tacaswell
    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?

  8. bryan-woods commented on Sep 16, 2014

    @bryan-woods
    Author

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

  9. added a commit that references this issue on Sep 16, 2014
    bd2e576
  10. tacaswell commented on Sep 16, 2014

    @tacaswell
    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).

  11. bryan-woods commented on Sep 16, 2014

    @bryan-woods
    Author

    Still no change to the EPS.

  12. tacaswell commented on Sep 16, 2014

    @tacaswell
    Member

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

  13. modified the milestones: v1.4.1, v1.4.x on Sep 16, 2014
  14. tacaswell commented on Sep 16, 2014

    @tacaswell
    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...

  15. added a commit that references this issue on Sep 16, 2014
    3424506
  16. tacaswell commented on Sep 16, 2014

    @tacaswell
    Member
  17. bryan-woods commented on Sep 17, 2014

    @bryan-woods
    Author

    That's the winner!

  18. tacaswell commented on Sep 17, 2014

    @tacaswell
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions