<div dir="ltr">Or use the mpl_kwargs keyword argument:<div><br></div><div>phase_plot.save('plot.eps', mpl_kwargs={'rasterized' : True})</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Apr 2, 2014 at 2:25 PM, Matthew Turk <span dir="ltr"><<a href="mailto:matthewturk@gmail.com" target="_blank">matthewturk@gmail.com</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>
<div class=""><br>
On Wed, Apr 2, 2014 at 5:21 PM, Geoffrey So <<a href="mailto:gsiisg@gmail.com">gsiisg@gmail.com</a>> wrote:<br>
> Hi Matt,<br>
><br>
> I tried different ways of getting the rasterized kwarg in PhasePlot but<br>
> failed.  I went back to using BinnedProfile2D and got what I wanted, except<br>
> for a minor bug.<br>
><br>
> When I'm using the following script, the bottom bin fits right into the<br>
> plotting window nicely, but the top of the plotting area always has one<br>
> extra bin of white space compared to PhasePlot's results.  Is there a bug so<br>
> the data and the plotting window doesn't align correctly at the top?<br>
<br>
</div>Yes -- if you look at what you're calling, it's "imshow", which<br>
displays it like a bitmap.  What yt will do is use pcolormesh, which<br>
actually requires bin edges, so that will give you a better looking<br>
image in that case.<br>
<br>
I think you will be able to get rasterized in as a keyword argument if<br>
you *manually* save your PhasePlot, similar to how the cookbook<br>
examples plot things by grabbing the axes/figure objects on plots.<br>
<br>
-Matt<br>
<div class="HOEnZb"><div class="h5"><br>
><br>
> If there's a way to make PhasePlot without the white lines between pixel or<br>
> make this script create perfectly binned bins like PhasePlot then everything<br>
> will be perfect for me.<br>
><br>
> From<br>
> G.S.<br>
><br>
> #----------------<br>
> from yt.mods import *<br>
> from matplotlib import *<br>
><br>
> i=1200<br>
> file='HD%04i' % i<br>
> pf=load(file+'/'+file)<br>
> dd=pf.h.all_data()<br>
><br>
> z = pf["CosmologyCurrentRedshift"]<br>
> res = pf["TopGridDimensions"][0]<br>
><br>
> def _HIFraction(field, data):<br>
>    return data["HI_Density"]/(data["HI_Density"]+data["HII_Density"])<br>
><br>
> add_field("HIFraction", function=_HIFraction, \<br>
>           units=r"\rho_\mathrm{HI}/\rho_\mathrm{H}")<br>
><br>
> nbins=128<br>
> fieldx='Density'<br>
> fieldy='HIFraction'<br>
> fieldc='CellVolumeCode'<br>
> xmin,xmax = dd.quantities['Extrema'](fieldx, non_zero=True)[0]<br>
> ymin,ymax = dd.quantities['Extrema'](fieldy, non_zero=True)[0]<br>
><br>
> pro = BinnedProfile2D(data_source=dd,<br>
>     x_n_bins=nbins, x_bin_field=fieldx,<br>
>     x_lower_bound=xmin, x_upper_bound=xmax, x_log=True,<br>
>     y_n_bins=nbins, y_bin_field=fieldy,<br>
>     y_lower_bound=ymin, y_upper_bound=ymax, y_log=True,<br>
>     lazy_reader=True, end_collect=True)<br>
><br>
> pro.add_fields(fieldc, weight=None)<br>
> extent = ([pro[fieldx][0], pro[fieldx][-1],pro[fieldy][0], pro[fieldy][-1]])<br>
> M=(pro[fieldc].transpose())<br>
> pylab.imshow(M, extent=extent, interpolation='nearest',<br>
>              origin='lower',aspect='auto',norm=colors.LogNorm())<br>
> pylab.yscale('log')<br>
> pylab.xscale('log')<br>
> pylab.ylabel(fieldy +<br>
>              " [$"+pf.field_info[fieldy].get_units()+"$]")<br>
> pylab.xlabel(fieldx +<br>
>              " [$"+pf.field_info[fieldx].get_units()+"$] (z=%2.2f)"<br>
>              % z, labelpad=0)<br>
><br>
> cb=pylab.colorbar()<br>
> cb.set_label(fieldc +<br>
>              " [$"+pf.field_info[fieldc].get_units()+"$]")<br>
> pylab.savefig('frames/'+file+fieldx+fieldy+fieldc+'.eps')<br>
> #-------------------<br>
><br>
><br>
> On Tue, Apr 1, 2014 at 11:27 AM, Matthew Turk <<a href="mailto:matthewturk@gmail.com">matthewturk@gmail.com</a>> wrote:<br>
>><br>
>> Hi Geoffrey,<br>
>><br>
>> I think the solution is in the rasterize=True argument to saving out<br>
>> the figure, which needs to be fed in at the matplotlib level.<br>
>><br>
>> -Matt<br>
>><br>
>> On Tue, Apr 1, 2014 at 2:24 PM, Geoffrey So <<a href="mailto:gsiisg@gmail.com">gsiisg@gmail.com</a>> wrote:<br>
>> > Hi all,<br>
>> ><br>
>> > Is it possible when saving phase plots in EPS format to get rid of the<br>
>> > white<br>
>> > outline of each pixel?  When shrinking the diagram the white makes the<br>
>> > colors look faded.<br>
>> ><br>
>> > From<br>
>> > G.S.<br>
>> ><br>
>> > _______________________________________________<br>
>> > yt-users mailing list<br>
>> > <a href="mailto:yt-users@lists.spacepope.org">yt-users@lists.spacepope.org</a><br>
>> > <a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br>
>> ><br>
>> _______________________________________________<br>
>> yt-users mailing list<br>
>> <a href="mailto:yt-users@lists.spacepope.org">yt-users@lists.spacepope.org</a><br>
>> <a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br>
><br>
><br>
><br>
> _______________________________________________<br>
> yt-users mailing list<br>
> <a href="mailto:yt-users@lists.spacepope.org">yt-users@lists.spacepope.org</a><br>
> <a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br>
><br>
_______________________________________________<br>
yt-users mailing list<br>
<a href="mailto:yt-users@lists.spacepope.org">yt-users@lists.spacepope.org</a><br>
<a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br>
</div></div></blockquote></div><br></div>