[yt-dev] EPS writer

John Wise jwise at physics.gatech.edu
Mon Mar 12 15:25:33 PDT 2012


Hi Geoffrey,

eps_writer only interacts with JPEGs, so you can first convert the PNG 
to a JPG with your favorite image editor or imagemagick (convert 
-quality 90 image.png image.jpg).  Then you can make an EPS file with 
that image.  The image should only be the phase plot without any decorators.

import yt.visualization.eps_writer as EPS
d = EPS.DualEPS()
d.axis_box(xrange=(0,1), yrange=(0,1), xlabel="xlabel", ylabel="ylabel")
d.insert_image('test.jpg')
d.colorbar('algae', zrange=(0.1,10), log=True, label="label", 
orientation="right")
d.save_fig('test.eps')

Let me know if this works for you.

John

On 03/09/2012 05:31 PM, Geoffrey So wrote:
> Hi, I guess this question mainly goes to John Wise,
>
> I currently have two columns of data I am plotting with matplotlib
> calls, but if I save them as EPS the file size is ~1.5 MB instead of png
> as ~35KB, is there a simple way to save them as EPS format, with PNG
> graph but LaTeX text for the axis in YT?
>
> During your latest YT workshop talk, you showed how we can create EPS
> images using PlotCollection png phase graph with LaTeX text, which is
> exactly what I wanted to do for my publication to bring down the image
> file size... Except my graphs were created from 2 columns of data
> (derived using YT but plotted with matplotlib) and not the
> PlotCollection engine.  Can the png be inserted to PlotCollection to
> take advantage of the EPS writer?
>
> Other suggestions, comments are welcomed (such as not even bother
> worrying about the file size, or this is beyond the scope of YT).
>
> From
> G.S.
>
> PS.  I've tried using the cmap=gray in the imshow call, and that cuts
> the file size down to 0.5MB, but colored plots are so much nicer!
>
>
>
> _______________________________________________
> yt-dev mailing list
> yt-dev at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org

-- 
John Wise
Assistant Professor of Physics
Center for Relativistic Astrophysics, Georgia Tech



More information about the yt-dev mailing list