<div dir="ltr">Hey Rick,<br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Nov 4, 2014 at 9:21 PM, Rick Sarmento <span dir="ltr"><<a href="mailto:rsarment@asu.edu" target="_blank">rsarment@asu.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto"><div><br></div><div><br></div><div>Hello all,<div><br></div><div>I’m having trouble getting yt to plot 2 gas-phase diagrams side-by-side in a grid. I can do this fine for a projection plot, phase plots seems to behave differently. Here’s the code — any idea how to get these two plots side by side sharing the same scale/color-bar?</div><div><br></div><blockquote style="margin:0px 0px 0px 40px;border:medium none;padding:0px"><div><div><div><font face="Courier New"><span style="font-size:12px"># fractional=True keyword -- divide the profile data by the sum. </span></font></div></div></div><div><div><div><font face="Courier New"><span style="font-size:12px">fns = [ "/Users/earnric/RAMSES-Data/coolingFixedTau/output_00010/info_00010.txt",</span></font></div></div></div><div><div><div><font face="Courier New"><span style="font-size:12px">       "/Users/earnric/RAMSES-Data/noCool/output_00010/info_00010.txt"]</span></font></div></div></div><div><div><div><font face="Courier New"><span style="font-size:12px"><br></span></font></div></div></div><div><div><div><font face="Courier New"><span style="font-size:12px">fig = plt.figure()</span></font></div></div></div><div><div><div><font face="Courier New"><span style="font-size:12px">grid = AxesGrid(fig, (0.075,0.075,0.85,0.85),</span></font></div></div></div><div><div><div><font face="Courier New"><span style="font-size:12px">                nrows_ncols = (1, 2),</span></font></div></div></div><div><div><div><font face="Courier New"><span style="font-size:12px">                axes_pad = 0.05,</span></font></div></div></div><div><div><div><font face="Courier New"><span style="font-size:12px">                label_mode = "L",</span></font></div></div></div><div><div><div><font face="Courier New"><span style="font-size:12px">                share_all = True,</span></font></div></div></div><div><div><div><font face="Courier New"><span style="font-size:12px">                cbar_location="right",</span></font></div></div></div><div><div><div><font face="Courier New"><span style="font-size:12px">                cbar_mode="single",</span></font></div></div></div><div><div><div><font face="Courier New"><span style="font-size:12px">                cbar_size="3%",</span></font></div></div></div><div><div><div><font face="Courier New"><span style="font-size:12px">                cbar_pad="0%")</span></font></div></div></div><div><div><div><font face="Courier New"><span style="font-size:12px">fig.suptitle("Gas Phase")</span></font></div></div></div><div><div><div><font face="Courier New"><span style="font-size:12px"><br></span></font></div></div></div><div><div><div><font face="Courier New"><span style="font-size:12px">for i, fn in enumerate(fns):</span></font></div></div></div><div><div><div><font face="Courier New"><span style="font-size:12px">    ds = yt.load(fn)</span></font></div></div></div><div><div><div><font face="Courier New"><span style="font-size:12px">    ad = ds.all_data()</span></font></div></div></div><div><div><div><font face="Courier New"><span style="font-size:12px">    p = yt.PhasePlot(ad, "density", "temperature", "cell_mass", x_bins=256, y_bins=256, weight_field=None, fractional=True )</span></font></div></div></div><div><div><div><font face="Courier New"><span style="font-size:12px">    plot = p.plots['cell_mass']</span></font></div></div></div><div><div><div><font face="Courier New"><span style="font-size:12px">    if i % 2 == 0:</span></font></div></div></div><div><div><div><font face="Courier New"><span style="font-size:12px">        ptype = "Gas phase ${H_2}$ cooling "</span></font></div></div></div><div><div><div><font face="Courier New"><span style="font-size:12px">    else:</span></font></div></div></div><div><div><div><font face="Courier New"><span style="font-size:12px">        ptype = "Gas phase Standard cooling "</span></font></div></div></div><div><div><div><font face="Courier New"><span style="font-size:12px">    zStr = ptype + "z = %.1f" % ds.current_redshift </span></font></div></div></div><div><div><div><font face="Courier New"><span style="font-size:12px">    plot.figure = fig</span></font></div></div></div><div><div><div><font face="Courier New"><span style="font-size:12px">    plot.axes = grid[i].axes</span></font></div></div></div><div><div><div><font face="Courier New"><span style="font-size:12px">    plot.cax = grid.cbar_axes[i]</span></font></div></div></div><div><div><div><font face="Courier New"><span style="font-size:12px">    #plot.annotate_title(zStr) # YOU HAVE TO DO THIS AFTER THE AXES calls</span></font></div></div></div><div><div><div><font face="Courier New"><span style="font-size:12px"><br></span></font></div></div></div><div><div><div><font face="Courier New"><span style="font-size:12px">    p['cell_mass'].axes.set_ylim (1e-1, 1e6)</span></font></div></div></div><div><div><div><font face="Courier New"><span style="font-size:12px">    p['cell_mass'].axes.set_xlim (1e-29, 1e-24)</span></font></div></div></div><div><div><div><font face="Courier New"><span style="font-size:12px">    p['cell_mass'].axes.set_title(zStr, fontsize=20)</span></font></div></div></div><div><div><div><font face="Courier New"><span style="font-size:12px">p.show()</span></font></div></div></div></blockquote></div></div></blockquote><div><br></div><div>FWIW, this is the first I've ever heard someone trying to do this. I can confirm that it doesn't work.<br></div><div><br></div><div>I tried experimenting a bit and unfortunately I think you're running into a limitation of matplotlib: AxesGrid doesn't support logarithmic x and y axes.<br><br></div><div>I can get something sort of sensible if I specify linear x and y axes and manually adjust the aspect ratio, but I don't think this is a particularly sustainable solution for supporting these sorts of plots: <br><br><a href="http://nbviewer.ipython.org/gist/ngoldbaum/ab71b48bd42e8c2a5b42" target="_blank">http://nbviewer.ipython.org/gist/ngoldbaum/ab71b48bd42e8c2a5b42</a><br><br></div><div>Unfortunately when I try to make the same plot using logarithmic axes, I get junk:<br><br><a href="http://nbviewer.ipython.org/gist/ngoldbaum/821e44612f53eae830d8">http://nbviewer.ipython.org/gist/ngoldbaum/821e44612f53eae830d8</a><br></div><div><br></div><div>I think the most straightforward way to do this would be to do it 100% manually (outside of PhasePlot) using a Profile2D object and matplotlib.  If you figure out something that works for you I think it would be a good addition for the cookbook. <br><br>It might be possible to use PhasePlot with a hand-constructured set of axes, but I've never tried to set that up so I'm not sure if you'll need to modify yt to get it to work.<br><br></div><div>Sorry I don't have better news for you - good luck with getting this plot working.<br><br></div><div>-Nathan<br></div><div> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto"><div><div><div><br></div><div><br></div><div>
<div style="color:rgb(0,0,0);letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;word-wrap:break-word"><div style="color:rgb(0,0,0);letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;word-wrap:break-word"><div style="font-size:15px"><i>Cheers,</i></div><div style="font-size:15px"><i><br></i></div><div style="font-size:15px"><i>Rick Sarmento</i></div><div><br></div><div><br></div></div><br></div><br><br>
</div>
<br></div></div></div><br>_______________________________________________<br>
yt-users mailing list<br>
<a href="mailto:yt-users@lists.spacepope.org" target="_blank">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></blockquote></div><br></div></div>