Intersecting polygons

Hi,

I have a semitransparent plot that I rather like:

image.png

I’d like to publish something like this in a journal which requires EPS figures. Unfortunately, EPS doesn’t support transparency.

How hard would it be to coax matplotlib (or another tool) to convert this semi-transparent figure into a non-semitransparent figure that looks the same? It would consist of more polygons, each of which has a constant RGB value in the transparent figure.

I don’t want to rasterize the lines, because I like zooming absurdly far into plots, and having them stay crisp.

Cheers,

Chris

Chris Beaumont :

I have a semitransparent plot that I rather like:

...

I'd like to publish something like this in a journal which requires EPS figures. Unfortunately, EPS doesn't support transparency.

How hard would it be to coax matplotlib (or another tool) to convert this semi-transparent figure into a non-semitransparent figure that looks the same?

I won't claim that this is an ultimate solution, but what I did a few times was to
1. Choose the svg backend, savefig the picture as svg.
2. Open in Inkscape and export as .eps.

The result was satisfactory.

Jerzy Karczmarczuk

Thanks for these tips. It looks like some programs (like illustrator, and pdf2ps) are semi-smart about handling transparency when converting to ps. Both have their quirks (illustrator seems to mess up the bounding box, pdf2ps makes the text look worse/fuzzy).

Is this the recommended/best strategy?

Thanks,

chris

···

On Thu, Aug 22, 2013 at 8:04 PM, Jerzy Karczmarczuk <jerzy.karczmarczuk@…3937…> wrote:

Chris Beaumont :

I have a semitransparent plot that I rather like:

I’d like to publish something like this in a journal which requires

EPS figures. Unfortunately, EPS doesn’t support transparency.

How hard would it be to coax matplotlib (or another tool) to convert

this semi-transparent figure into a non-semitransparent figure that

looks the same?

I won’t claim that this is an ultimate solution, but what I did a few

times was to

  1. Choose the svg backend, savefig the picture as svg.

  2. Open in Inkscape and export as .eps.

The result was satisfactory.

Jerzy Karczmarczuk


Introducing Performance Central, a new site from SourceForge and

AppDynamics. Performance Central is your source for news, insights,

analysis and resources for efficient Application Performance Management.

Visit us today!

http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk


Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Hey Chris,

I had a similar problem. I saved the transparent objects, so the polygons in your case, as a high-resolution png and the axes, dots, lines, text objects and everything else to an eps. Finally, I just layed them on top of each other in Illustrator and saved as eps, which produced a decent result. But this was only a work-around as well. They might be better options...

Cheers
Florian

···

Am 23.08.2013 00:55, schrieb Chris Beaumont:

Hi,

I have a semitransparent plot that I rather like:

Inline image 1
I'd like to publish something like this in a journal which requires EPS figures. Unfortunately, EPS doesn't support transparency.

How hard would it be to coax matplotlib (or another tool) to convert this semi-transparent figure into a non-semitransparent figure that looks the same? It would consist of more polygons, each of which has a constant RGB value in the transparent figure.

I don't want to rasterize the lines, because I like zooming absurdly far into plots, and having them stay crisp.

Cheers,
Chris

------------------------------------------------------------------------------
Introducing Performance Central, a new site from SourceForge and
AppDynamics. Performance Central is your source for news, insights,
analysis and resources for efficient Application Performance Management.
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

Dear Chris and List,

pdf2ps is usually just a front end to a long-winded ghostscript (“gs”) command. On my system this comes out as:

gs -q -dNOPAUSE -dBATCH -P- -dSAFER -sDEVICE=ps2write “-sOutputFile=$outfile” -c save pop -f “$1”

If you’re feeling brave, you can look at the ghostscript manual for ways to improve upon the results (http://www.ghostscript.com/doc/9.07/Use.htm).

I’ve had to play this “game” with Astronomy journals in the past, and what I actually did was save the output as a JPEG of ridiculously high resolution and then put a postscript wrapper around it using jpeg2ps (http://www.pdflib.com/download/free-software/jpeg2ps/).

Not pretty, but it works.

Good luck,
Jon

···

Jon Ramsey

===============================
jon.p.ramsey@…287…

On 23 August 2013 03:32, Chris Beaumont <cbeaumont@…1081…> wrote:

Thanks for these tips. It looks like some programs (like illustrator, and pdf2ps) are semi-smart about handling transparency when converting to ps. Both have their quirks (illustrator seems to mess up the bounding box, pdf2ps makes the text look worse/fuzzy).

Is this the recommended/best strategy?

Thanks,

chris


Introducing Performance Central, a new site from SourceForge and

AppDynamics. Performance Central is your source for news, insights,

analysis and resources for efficient Application Performance Management.

Visit us today!

http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk


Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-users

On Thu, Aug 22, 2013 at 8:04 PM, Jerzy Karczmarczuk <jerzy.karczmarczuk@…3937…> wrote:

Chris Beaumont :

I have a semitransparent plot that I rather like:

I’d like to publish something like this in a journal which requires

EPS figures. Unfortunately, EPS doesn’t support transparency.

How hard would it be to coax matplotlib (or another tool) to convert

this semi-transparent figure into a non-semitransparent figure that

looks the same?

I won’t claim that this is an ultimate solution, but what I did a few

times was to

  1. Choose the svg backend, savefig the picture as svg.

  2. Open in Inkscape and export as .eps.

The result was satisfactory.

Jerzy Karczmarczuk


Introducing Performance Central, a new site from SourceForge and

AppDynamics. Performance Central is your source for news, insights,

analysis and resources for efficient Application Performance Management.

Visit us today!

http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk


Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Who can really say what is a/the recommended strategy?...

I am almost certain that the process described by Jon Ramsey - passing through jpeg - is better to be avoided. It probably works decently, and the JPEG is quite economic, but the conversion of a raster into EPS produces large files, and - as you said - the rasterization makes it not so scalable. And in general, a lossy compression is methodologically wrong here...

I compared on a sample picture (similar to yours, but simpler, from the matplotlib documentation) these two methods:

1. Generate pdf, use pdf2ps (and convert to eps)
2. Generate svg, use inkscape to export eps.

The results are visually comparable. I don't notice much of fuzziness; perhaps this is the anti-aliasing on your display?
My version, the passage through svg produces a file which is more than 3 times shorter.

Good luck.

Jerzy Karczmarczuk

PS. Try to convince the Dark Powers of the journal you send your work, that they modernize their processing and accept PDF.

···

Le 23/08/2013 03:32, Chris Beaumont a écrit :

It looks like some programs (like illustrator, and pdf2ps) are semi-smart about handling transparency when converting to ps. Both have their quirks (illustrator seems to mess up the bounding box, pdf2ps makes the text look worse/fuzzy).

Is this the recommended/best strategy?

PS. Try to convince the Dark Powers of the journal you send your work,
that they modernize their processing and accept PDF.

+1

Thanks for the tips – I wish there was a way to do this within MPL, but it sounds like I’ll have to live with external hackery.

···

PS. Try to convince the Dark Powers of the journal you send your work,

that they modernize their processing and accept PDF.

+1

I know, right?

chris