Hello,

I am having some problems with the PS backend. I used the following
script to create a PostScript file

#!/usr/bin/env python
import matplotlib
matplotlib.use('PS')
import matplotlib.pyplot as plt
import numpy

x1 = numpy.arange(0,5)
y1 = x1
plt.plot(x1, y1)
plt.savefig('ps_backend.ps')
plt.show()


When I tried to open the PostScript file in GSview, there is the
following warning, and the file does not render properly. I have
attached the PostScript file and a screenshot of the incorrect rendering.

DSC Error
At line 233:
   %%Page: 1 1
This %%Page: line occurred in the trailer, which is not legal.
EPS files should be encapsulated in %%BeginDocument / %%EndDocument.
If is possible that an EPS file was incorrectly encapsulated,
and that we have been confused by the %%Trailer in an EPS file.


The error can be eliminated by removing the line with %%EOF at line 230, but I don't know anything about PostScript or if that change would have any other effects. I only found this solution after comparing with the output from the Cairo backend. The same change to PostScript output can be achieved with the following diff (from svn diff), but again, I don't know if it is appropriate.

Index: ttconv/pprdrv_tt.cpp
===================================================================
--- ttconv/pprdrv_tt.cpp        (revision 6810)
+++ ttconv/pprdrv_tt.cpp        (working copy)
@@ -1070,7 +1070,6 @@
        } /* end of if Type 42 not understood. */

     stream.putline("FontName currentdict end definefont pop");
-    stream.putline("%%EOF");
     } /* end of ttfont_trailer() */

 /*------------------------------------------------------------------


Paul Novak

Attachment: ps_backend.ps
Description: PostScript document

<<inline: incorrect_rendering.png>>

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to