Thank you John, that worked perfectly.<div><br></div><div>I had to do a pip install pyx and added a line in my python script to call "convert"</div><div><br></div><div><div>stream = os.popen("convert -quality 90 gasmass_v_SFReps.png gasmass_v_SFReps.jpg")</div>
<div><br></div><div>Things I couldn't do:</div><div>- changing the font or have latex style </div><div>- display fraction using the $\frac{x}{y}$ to get an x over y.</div><div>- have the title outside of the jpg image (currently the title sits on top blocking part of the image)</div>
<div><br></div><div>But in a paper I don't think they're that important. The colored version is now ~170k instead of ~500k</div><div><br></div><div>From</div><div>G.S.</div><div><br><div class="gmail_quote">On Mon, Mar 12, 2012 at 3:25 PM, John Wise <span dir="ltr"><<a href="mailto:jwise@physics.gatech.edu" target="_blank">jwise@physics.gatech.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Geoffrey,<br>
<br>
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.<br>
<br>
import yt.visualization.eps_writer as EPS<br>
d = EPS.DualEPS()<br>
d.axis_box(xrange=(0,1), yrange=(0,1), xlabel="xlabel", ylabel="ylabel")<br>
d.insert_image('test.jpg')<br>
d.colorbar('algae', zrange=(0.1,10), log=True, label="label", orientation="right")<br>
d.save_fig('test.eps')<br>
<br>
Let me know if this works for you.<br>
<br>
John<div><div><br>
<br>
On 03/09/2012 05:31 PM, Geoffrey So wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div>
Hi, I guess this question mainly goes to John Wise,<br>
<br>
I currently have two columns of data I am plotting with matplotlib<br>
calls, but if I save them as EPS the file size is ~1.5 MB instead of png<br>
as ~35KB, is there a simple way to save them as EPS format, with PNG<br>
graph but LaTeX text for the axis in YT?<br>
<br>
During your latest YT workshop talk, you showed how we can create EPS<br>
images using PlotCollection png phase graph with LaTeX text, which is<br>
exactly what I wanted to do for my publication to bring down the image<br>
file size... Except my graphs were created from 2 columns of data<br>
(derived using YT but plotted with matplotlib) and not the<br>
PlotCollection engine. Can the png be inserted to PlotCollection to<br>
take advantage of the EPS writer?<br>
<br>
Other suggestions, comments are welcomed (such as not even bother<br>
worrying about the file size, or this is beyond the scope of YT).<br>
<br>
From<br>
G.S.<br>
<br>
PS. I've tried using the cmap=gray in the imshow call, and that cuts<br>
the file size down to 0.5MB, but colored plots are so much nicer!<br>
<br>
<br>
<br></div></div><div>
______________________________<u></u>_________________<br>
yt-dev mailing list<br>
<a href="mailto:yt-dev@lists.spacepope.org" target="_blank">yt-dev@lists.spacepope.org</a><br>
<a href="http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org" target="_blank">http://lists.spacepope.org/<u></u>listinfo.cgi/yt-dev-spacepope.<u></u>org</a><br>
</div></blockquote><span><font color="#888888">
<br>
-- <br>
John Wise<br>
Assistant Professor of Physics<br>
Center for Relativistic Astrophysics, Georgia Tech</font></span><div><div><br>
______________________________<u></u>_________________<br>
yt-dev mailing list<br>
<a href="mailto:yt-dev@lists.spacepope.org" target="_blank">yt-dev@lists.spacepope.org</a><br>
<a href="http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org" target="_blank">http://lists.spacepope.org/<u></u>listinfo.cgi/yt-dev-spacepope.<u></u>org</a><br>
</div></div></blockquote></div><br></div></div>