Postscript ouput on OS X problem.

Hiya, i'm having a problem getting a valid postscript file

    > produced on OS X. Using the example subplot_demo.py,
    > modified to include the line:

    > savefig('subplot_demo')

    > in the place of the show() command, and running it using:

    > python subplot_demo.py -dPS

    > Produces the .ps file (available here for reference:
    > http://www.irbdavid.com/misc/subplot_demo.ps ), which can't
    > be opened by Preview on os x - says its can't convert it to
    > PDF & cant open the file. Checked the permissions etc on
    > the file and they're fine.

    > Its pretty much a default installation of matplotlib etc,
    > and output displays fine on screen, using the wxPython /
    > wxAgg thing (I think that's what i mean :smiley: )

We've noticed this on tiger several times. Some default system fault
is causing troubles though we haven't identified which one. The
recommended fix it to put the Vera fonts (which matplotlib ships with)
first in your rc file (http://matplotlib.sf.net/matplotlibrc) and
remove your ~/.matplotlib/ttf.cache before rerunning

Ie, you fonts section of ex should look something like this:

  font.serif : Bitstream Vera Serif, New Century Schoolbook, Century Schoolbook L, Utopia, ITC Bookman, Bookman, Nimbus Roman No9 L, Times New Roman, Times, Palatino, Charter, serif
  font.sans-serif : Bitstream Vera Sans, Lucida Grande, Verdana, Geneva, Lucid, Arial, Helvetica, Avant Garde, sans-serif
  font.cursive : Apple Chancery, Textile, Zapf Chancery, Sand, cursive
  font.fantasy : Comic Sans MS, Chicago, Charcoal, Impact, Western, fantasy
  font.monospace : Bitstream Vera Sans Mono, Andale Mono, Nimbus Mono L, Courier New, Courier, Fixed, Terminal, monospace

In future releases of mpl, this will be the default.

JDH

For the benefit of the mailing list & developers, this fix works fine
for me (OS X Tiger 10.4.7)

Cheers John.

Dave

···

On 04/09/06, John Hunter <jdhunter@...4...> wrote:

    > Hiya, i'm having a problem getting a valid postscript file
    > produced on OS X. Using the example subplot_demo.py,
    > modified to include the line:

    > savefig('subplot_demo')

    > in the place of the show() command, and running it using:

    > python subplot_demo.py -dPS

    > Produces the .ps file (available here for reference:
    > http://www.irbdavid.com/misc/subplot_demo.ps ), which can't
    > be opened by Preview on os x - says its can't convert it to
    > PDF & cant open the file. Checked the permissions etc on
    > the file and they're fine.

    > Its pretty much a default installation of matplotlib etc,
    > and output displays fine on screen, using the wxPython /
    > wxAgg thing (I think that's what i mean :smiley: )

We've noticed this on tiger several times. Some default system fault
is causing troubles though we haven't identified which one. The
recommended fix it to put the Vera fonts (which matplotlib ships with)
first in your rc file (http://matplotlib.sf.net/matplotlibrc) and
remove your ~/.matplotlib/ttf.cache before rerunning

Ie, you fonts section of ex should look something like this:

  font.serif : Bitstream Vera Serif, New Century Schoolbook, Century Schoolbook L, Utopia, ITC Bookman, Bookman, Nimbus Roman No9 L, Times New Roman, Times, Palatino, Charter, serif
  font.sans-serif : Bitstream Vera Sans, Lucida Grande, Verdana, Geneva, Lucid, Arial, Helvetica, Avant Garde, sans-serif
  font.cursive : Apple Chancery, Textile, Zapf Chancery, Sand, cursive
  font.fantasy : Comic Sans MS, Chicago, Charcoal, Impact, Western, fantasy
  font.monospace : Bitstream Vera Sans Mono, Andale Mono, Nimbus Mono L, Courier New, Courier, Fixed, Terminal, monospace

In future releases of mpl, this will be the default.

JDH

I have been having problems with postscript output from MPL on my various Macs that is just beyond the problem discussed in the tread here. But this seemed like the best place to bring it up. The basic problem is that Adobe products like Illustrator can't read MPL .eps output.

When I 'Open' the file, OS X uses ghostscript to convert the EPS to PDF, and this displays fine. I can use Preview to save this file, and it looks alright, however, none of the Adobe products can read the PDF either. Usually the file will open, but the fonts are all screwed up.

When I use pstopdf from teTeX (but *not* epstopdf -- that doesn't work for some strange reason), then I can open my new PDF file in illustrator.

I think that opening an EPS in Illustrator is the ultimate test of EPS format compliance, as those are the folks who made it. What can we do to make MPL output universally readable postscript?

-Rob

p.s. One I finally do get it into Illustrator, it becomes clear that MPL makes very nice, efficient, easily editable files... unlike MATLAB. For me this is yet another big reason to switch to python/numpy/mpl.

···

----
Rob Hetland, Associate Professor
Dept. of Oceanography, Texas A&M University
http://pong.tamu.edu/~rob
phone: 979-458-0096, fax: 979-845-6331

FWIW, I've had very good luck recently using inkscape
(http://www.inkscape.org/) to edit PS files, both old ones made by
who-knows-what and fresh mpl-off-svn ones. I've been able to fix old
labels that needed changes for figures whose data source is nowhere to
be found, change a line color and dashing/cap style, etc. I'm not a
graphics artist and have never used Illustrator, but for my needs,
inkscape has so far been an excellent (and free!) solution.

Note that this is on a Linux Ubuntu Dapper box, with the pstoedit
program installed, which inkscape uses to read *PS files into an
editable vector format.

Cheers,

f

···

On 9/6/06, Rob Hetland <hetland@...760...> wrote:

I have been having problems with postscript output from MPL on my
various Macs that is just beyond the problem discussed in the tread
here. But this seemed like the best place to bring it up. The basic
problem is that Adobe products like Illustrator can't read MPL .eps
output.