<div dir="ltr">Hi Matt,<div><br></div><div>I tried different ways of getting the rasterized kwarg in PhasePlot but failed.  I went back to using BinnedProfile2D and got what I wanted, except for a minor bug.</div><div><br>
</div><div>When I'm using the following script, the bottom bin fits right into the plotting window nicely, but the top of the plotting area always has one extra bin of white space compared to PhasePlot's results.  Is there a bug so the data and the plotting window doesn't align correctly at the top?</div>
<div><br></div><div>If there's a way to make PhasePlot without the white lines between pixel or make this script create perfectly binned bins like PhasePlot then everything will be perfect for me.</div><div><br></div>
<div>From</div><div>G.S.</div><div><br></div><div>#----------------</div><div><div>from yt.mods import *</div><div>from matplotlib import *</div><div><br></div><div>i=1200</div><div>file='HD%04i' % i</div><div>pf=load(file+'/'+file)</div>
<div>dd=pf.h.all_data()</div><div><br></div><div>z = pf["CosmologyCurrentRedshift"]</div><div>res = pf["TopGridDimensions"][0]</div><div><br></div><div>def _HIFraction(field, data):</div><div>   return data["HI_Density"]/(data["HI_Density"]+data["HII_Density"])</div>
<div><br></div><div>add_field("HIFraction", function=_HIFraction, \</div><div>          units=r"\rho_\mathrm{HI}/\rho_\mathrm{H}")</div><div><br></div><div>nbins=128</div><div>fieldx='Density'</div>
<div>fieldy='HIFraction'</div><div>fieldc='CellVolumeCode'</div><div>xmin,xmax = dd.quantities['Extrema'](fieldx, non_zero=True)[0]</div><div>ymin,ymax = dd.quantities['Extrema'](fieldy, non_zero=True)[0]</div>
<div><br></div><div>pro = BinnedProfile2D(data_source=dd,</div><div>    x_n_bins=nbins, x_bin_field=fieldx,</div><div>    x_lower_bound=xmin, x_upper_bound=xmax, x_log=True,</div><div>    y_n_bins=nbins, y_bin_field=fieldy,</div>
<div>    y_lower_bound=ymin, y_upper_bound=ymax, y_log=True,</div><div>    lazy_reader=True, end_collect=True)</div><div><br></div><div>pro.add_fields(fieldc, weight=None)</div><div>extent = ([pro[fieldx][0], pro[fieldx][-1],pro[fieldy][0], pro[fieldy][-1]])</div>
<div>M=(pro[fieldc].transpose())</div><div>pylab.imshow(M, extent=extent, interpolation='nearest',</div><div>             origin='lower',aspect='auto',norm=colors.LogNorm())</div><div>pylab.yscale('log')</div>
<div>pylab.xscale('log')</div><div>pylab.ylabel(fieldy +</div><div>             " [$"+pf.field_info[fieldy].get_units()+"$]")</div><div>pylab.xlabel(fieldx +</div><div>             " [$"+pf.field_info[fieldx].get_units()+"$] (z=%2.2f)"</div>
<div>             % z, labelpad=0)</div><div><br></div><div>cb=pylab.colorbar()</div><div>cb.set_label(fieldc +</div><div>             " [$"+pf.field_info[fieldc].get_units()+"$]")</div><div>pylab.savefig('frames/'+file+fieldx+fieldy+fieldc+'.eps')</div>
</div><div>#-------------------</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Apr 1, 2014 at 11:27 AM, 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>
<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>
<div><div class="h5"><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 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>
</div></div>> _______________________________________________<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>
</blockquote></div><br></div>