vector EPS

Hi Forum,

I just had an article accepted and they want to have the figures in vector EPS format with text that can be re-sized. I have produced all my figures with matplotlib. However, it seems that MPL rasterizes everything in the production of its EPS output. Is there any way to get around this without learning a new plotting package?

Cheers,

Matt

Hi Matt,

I cannot see any difference between matplotlib generated eps and others.
I used the code below to generate the attached eps. Maybe you could be more
specific in what is rasterized in the wrong way. By the way what version of
matplotlib you are using?

Kind regards,
Matthias

import matplotlib
matplotlib.use("PS") # using PS-backend (non-interactive)
import matplotlib.pyplot as plt
import numpy as np

x = np.linspace(0.0, 2*np.pi, 200)
plt.plot(x, np.sin(x))
plt.savefig("my_test.eps")

my_test.eps (11.1 KB)

···

On Thursday 21 January 2010 07:50:07 Matthew Czesarski wrote:

Hi Forum,

I just had an article accepted and they want to have the figures in vector
EPS format with text that can be re-sized. I have produced all my figures
with matplotlib. However, it seems that MPL rasterizes everything in the
production of its EPS output. Is there any way to get around this without
learning a new plotting package?

Cheers,
Matt

Hey Matthias,

Oh, I can make eps files themselves no problem…

In as much as I don’t really understand the difference between vector and raster graphics, I was told to submit 89mm images (I can make them 89mm, fortunately…), with text that can be resized by the graphics department. For which I understand it should not be rasterized at all, but the fonts, sizes, coordinates, etc should be embedded in the postscript. I.e. not the way MPL produces .eps. Does this sound right to you?

Thanks,

Matt

Hey Matt, Hello list,

I'm sorry, I'm not an expert in eps-graphics. For me the final pics look good
and I have no idea what is different between matplotlib eps-files and
eps-files generated somewhere else.

Maybe someone has an idea.

Kind regards,
Matthias

···

On Thursday 21 January 2010 10:37:32 Matthew Czesarski wrote:

Hey Matthias,

Oh, I can make eps files themselves no problem...

In as much as I don't really understand the difference between vector and
raster graphics, I was told to submit 89mm images (I can make them 89mm,
fortunately...), with text that can be resized by the graphics department.
For which I understand it should not be rasterized at all, but the fonts,
sizes, coordinates, etc should be embedded in the postscript. I.e. not the
way MPL produces .eps. Does this sound right to you?

Thanks,
Matt

I believe that MPL produces vector files.

If you want to check by yourself I suggest that you zoom "at will" on an eps file. If you cannot observe rasterization artifacts it should be right.

There is a "rasterized" option that will affect part of a plot but will leave the text and axes vectorized.

Pierre

···

Le 21 janv. 10 à 10:58, Matthias Michler a écrit :

Hey Matt, Hello list,

I'm sorry, I'm not an expert in eps-graphics. For me the final pics look good
and I have no idea what is different between matplotlib eps-files and
eps-files generated somewhere else.

Maybe someone has an idea.

Kind regards,
Matthias

On Thursday 21 January 2010 10:37:32 Matthew Czesarski wrote:

Hey Matthias,

Oh, I can make eps files themselves no problem...

In as much as I don't really understand the difference between vector and
raster graphics, I was told to submit 89mm images (I can make them 89mm,
fortunately...), with text that can be resized by the graphics department.
For which I understand it should not be rasterized at all, but the fonts,
sizes, coordinates, etc should be embedded in the postscript. I.e. not the
way MPL produces .eps. Does this sound right to you?

Thanks,
Matt

------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Sometimes, an EPS contains a rasterised "screenshot" of the actual vector image. E.g. some office products show only the raserised image while editing the document. When printed, the vector data is used.

Sven

···

On Thursday 21 January 2010 11:10:00 Pierre de Buyl wrote:

I believe that MPL produces vector files.

If you want to check by yourself I suggest that you zoom "at will" on
an eps file. If you cannot observe rasterization artifacts it should
be right.

There is a "rasterized" option that will affect part of a plot but
will leave the text and axes vectorized.

Pierre

Le 21 janv. 10 à 10:58, Matthias Michler a écrit :

> Hey Matt, Hello list,
>
> I'm sorry, I'm not an expert in eps-graphics. For me the final pics
> look good
> and I have no idea what is different between matplotlib eps-files and
> eps-files generated somewhere else.
>
> Maybe someone has an idea.
>
> Kind regards,
> Matthias
>
> On Thursday 21 January 2010 10:37:32 Matthew Czesarski wrote:
>> Hey Matthias,
>>
>> Oh, I can make eps files themselves no problem...
>>
>> In as much as I don't really understand the difference between
>> vector and
>> raster graphics, I was told to submit 89mm images (I can make them
>> 89mm,
>> fortunately...), with text that can be resized by the graphics
>> department.
>> For which I understand it should not be rasterized at all, but the
>> fonts,
>> sizes, coordinates, etc should be embedded in the postscript. I.e.
>> not the
>> way MPL produces .eps. Does this sound right to you?
>>
>> Thanks,
>> Matt
>
>
>
> ----------------------------------------------------------------------
> --------
> Throughout its 18-year history, RSA Conference consistently
> attracts the
> world's best and brightest in the field, creating opportunities for
> Conference
> attendees to learn about information security's most important
> issues through
> interactions with peers, luminaries and emerging and established
> companies.
> http://p.sf.net/sfu/rsaconf-dev2dev
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users

------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

hi matt,

i think i know maybe what you mean: if i save a matplotlib figure as eps and then use pstoedit for further processing with xfig, the ticklabels are somehow not correctly recognized as text.

as far as i understand, this is an issue with the mathtext capabilities. you can see what i do as workaround in
http://www.thamnos.de/repos/sebtools/sebtools.main/sebtools.py
(class 'Fig', style 'f')

unfortunately, i do not recall all details any more. if i was to look into that again, i would start playing with the text.usetex parameter. i would expect this to be enough to render linear axes correctly (although not as nicely). if you have logarithmic axes, it gets more complicated as something like 10^5 IS a mathtext. i've therefore made a class MyLogFormatterMathtext which outputs the labels very ugly but as normal text.

i hope that something along these lines can help you, i was using pstoedit a lot to see whether the text is recognized as text or not.

good luck,
sebastian.

···

Matthew Czesarski <matthew.czesarski@...287...> wrote:

... it seems that MPL rasterizes everything in the
production of its EPS output. Is there any way to get around this ...

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.

You may want to play with the ps.fonttype parameter. If it's type 3 (the default) only the characters used in the plot are embedded in the file. If type 42, the entire font is embedded. That may create the editability that the publisher is asking for.

Mike

Sebastian Busch wrote:

···

Matthew Czesarski <matthew.czesarski@...287...> wrote:

... it seems that MPL rasterizes everything in the
production of its EPS output. Is there any way to get around this ...

hi matt,

i think i know maybe what you mean: if i save a matplotlib figure as eps and then use pstoedit for further processing with xfig, the ticklabels are somehow not correctly recognized as text.

as far as i understand, this is an issue with the mathtext capabilities. you can see what i do as workaround in
http://www.thamnos.de/repos/sebtools/sebtools.main/sebtools.py
(class 'Fig', style 'f')

unfortunately, i do not recall all details any more. if i was to look into that again, i would start playing with the text.usetex parameter. i would expect this to be enough to render linear axes correctly (although not as nicely). if you have logarithmic axes, it gets more complicated as something like 10^5 IS a mathtext. i've therefore made a class MyLogFormatterMathtext which outputs the labels very ugly but as normal text.

i hope that something along these lines can help you, i was using pstoedit a lot to see whether the text is recognized as text or not.

good luck,
sebastian.

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.

------------------------------------------------------------------------

------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
------------------------------------------------------------------------

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
  
--
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA

http://matplotlib.sourceforge.net/users/usetex.html
"Postscript options
In order to produce encapsulated postscript files that can be embedded in a new LaTeX document, the default behavior of matplotlib is to distill the output, which removes some postscript operators used by LaTeX that are illegal in an eps file. This step produces results which may be unacceptable to some users, because the text is coarsely rasterized and converted to bitmaps, which are not scalable like standard postscript, and the text is not searchable. One workaround is to to set ps.distiller.res to a higher value (perhaps 6000) in your rc settings, which will produce larger files but may look better and scale reasonably. A better workaround, which requires Poppler <http://poppler.freedesktop.org/> or Xpdf <http://www.foolabs.com/xpdf>, can be activated by changing the ps.usedistiller rc setting to xpdf. This alternative produces postscript without rasterizing text, so it scales properly, can be edited in Adobe Illustrator, and searched text in pdf documents."

fwiw,
Alan Isaac