Thank you John, that worked perfectly.
I had to do a pip install pyx and added a line in my python script to call
"convert"
stream = os.popen("convert -quality 90 gasmass_v_SFReps.png
gasmass_v_SFReps.jpg")
Things I couldn't do:
- changing the font or have latex style
- display fraction using the $\frac{x}{y}$ to get an x over y.
- have the title outside of the jpg image (currently the title sits on top
blocking part of the image)
But in a paper I don't think they're that important. The colored version is
now ~170k instead of ~500k
From
G.S.
On Mon, Mar 12, 2012 at 3:25 PM, John Wise
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@lists.spacepope.org http://lists.spacepope.org/**listinfo.cgi/yt-dev-spacepope.**orghttp://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org
-- John Wise Assistant Professor of Physics Center for Relativistic Astrophysics, Georgia Tech
______________________________**_________________ yt-dev mailing list yt-dev@lists.spacepope.org http://lists.spacepope.org/**listinfo.cgi/yt-dev-spacepope.**orghttp://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org