<div dir="ltr">There are several examples starting here in the cookbook:<div><br></div><div><a href="http://yt-project.org/doc/cookbook/complex_plots.html#multipanel-with-axes-labels">http://yt-project.org/doc/cookbook/complex_plots.html#multipanel-with-axes-labels</a><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Oct 28, 2014 at 9:09 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:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">While I’m on the subject of plot title … I’m trying to put two plots in a grid, side-by-side… using different RAMSES data files. I need to have titles/annotations on these to distinguish which one has H2 cooling turned on and which has it off… I’ve tried several API calls… with the results below… </div><div style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto"><br></div><div style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">Anyone know how to do this? Also, what if I wanted a 2x2 grid of plots? </div><div style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto"><br></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div style="color:rgb(0,0,0);margin:0px"><div style="margin:0px"><font face="Courier New"><b>fns = ["/Users/earnric/RAMSES-Data/cooling/output_00008/info_00008.txt",</b></font></div></div><div style="color:rgb(0,0,0);margin:0px"><div style="margin:0px"><font face="Courier New"><b>       "/Users/earnric/RAMSES-Data/noCool/output_00008/info_00008.txt"]</b></font></div></div><div style="color:rgb(0,0,0);margin:0px"><div style="margin:0px"><font face="Courier New"><b><br></b></font></div></div><div style="color:rgb(0,0,0);margin:0px"><div style="margin:0px"><font face="Courier New"><b>fields = ["density","temperature"]</b></font></div></div><div style="color:rgb(0,0,0);margin:0px"><div style="margin:0px"><font face="Courier New"><b><br></b></font></div></div><div style="color:rgb(0,0,0);margin:0px"><div style="margin:0px"><font face="Courier New"><b>fig = plt.figure()</b></font></div></div><div style="color:rgb(0,0,0);margin:0px"><div style="margin:0px"><font face="Courier New"><b>grid = AxesGrid(fig, (0.075,0.075,0.85,0.85),</b></font></div></div><div style="color:rgb(0,0,0);margin:0px"><div style="margin:0px"><font face="Courier New"><b>                nrows_ncols = (1, 2),</b></font></div></div><div style="color:rgb(0,0,0);margin:0px"><div style="margin:0px"><font face="Courier New"><b>                axes_pad = 0.05,</b></font></div></div><div style="color:rgb(0,0,0);margin:0px"><div style="margin:0px"><font face="Courier New"><b>                label_mode = "L",</b></font></div></div><div style="color:rgb(0,0,0);margin:0px"><div style="margin:0px"><font face="Courier New"><b>                share_all = True,</b></font></div></div><div style="color:rgb(0,0,0);margin:0px"><div style="margin:0px"><font face="Courier New"><b>                cbar_location="right",</b></font></div></div><div style="color:rgb(0,0,0);margin:0px"><div style="margin:0px"><font face="Courier New"><b>                cbar_mode="single",</b></font></div></div><div style="color:rgb(0,0,0);margin:0px"><div style="margin:0px"><font face="Courier New"><b>                cbar_size="3%",</b></font></div></div><div style="color:rgb(0,0,0);margin:0px"><div style="margin:0px"><font face="Courier New"><b>                cbar_pad="0%")</b></font></div></div><div style="color:rgb(0,0,0);margin:0px"><div style="margin:0px"><font face="Courier New"><b>fig.suptitle("Gas Temperature")</b></font></div></div><div style="color:rgb(0,0,0);margin:0px"><div style="margin:0px"><font face="Courier New"><b><br></b></font></div></div><div style="color:rgb(0,0,0);margin:0px"><div style="margin:0px"><font face="Courier New"><b>for i, fn in enumerate(fns):</b></font></div></div><div style="color:rgb(0,0,0);margin:0px"><div style="margin:0px"><font face="Courier New"><b>    # Load the data and create a single plot</b></font></div></div><div style="color:rgb(0,0,0);margin:0px"><div style="margin:0px"><font face="Courier New"><b>    ds = yt.load(fn) # load data</b></font></div></div><div style="color:rgb(0,0,0);margin:0px"><div style="margin:0px"><font face="Courier New"><b>    p = yt.ProjectionPlot(ds, 'z', 'temperature', weight_field="density")</b></font></div></div><div style="color:rgb(0,0,0);margin:0px"><div style="margin:0px"><font face="Courier New"><b><br></b></font></div></div><div style="color:rgb(0,0,0);margin:0px"><div style="margin:0px"><font face="Courier New"><b>    # Ensure the colorbar limits match for all plots</b></font></div></div><div style="color:rgb(0,0,0);margin:0px"><div style="margin:0px"><font face="Courier New"><b>    p.set_zlim('temperature', 0.1, 1e4)</b></font></div></div><div style="color:rgb(0,0,0);margin:0px"><div style="margin:0px"><font face="Courier New"><b><br></b></font></div></div><div style="color:rgb(0,0,0);margin:0px"><div style="margin:0px"><font face="Courier New"><b>    # This forces the ProjectionPlot to redraw itself on the AxesGrid axes.</b></font></div></div><div style="color:rgb(0,0,0);margin:0px"><div style="margin:0px"><font face="Courier New"><b>    plot = p.plots['temperature']</b></font></div></div><div style="color:rgb(0,0,0);margin:0px"><div style="margin:0px"><font face="Courier New"><b>    if i % 2 == 0:</b></font></div></div><div style="color:rgb(0,0,0);margin:0px"><div style="margin:0px"><font face="Courier New"><b>        ptype = "Cooling "</b></font></div></div><div style="color:rgb(0,0,0);margin:0px"><div style="margin:0px"><font face="Courier New"><b>    else:</b></font></div></div><div style="color:rgb(0,0,0);margin:0px"><div style="margin:0px"><font face="Courier New"><b>        ptype = "No cooling "</b></font></div></div><div style="color:rgb(0,0,0);margin:0px"><div style="margin:0px"><font face="Courier New"><b>    zStr = ptype + "z = %.1f" % ds.current_redshift </b></font></div></div><div style="color:rgb(0,0,0);margin:0px"><div style="margin:0px"><font face="Courier New"><b>    #p.annotate_title(zStr) # Doesn't work... bug</b></font></div></div><div style="color:rgb(0,0,0);margin:0px"><div style="margin:0px"><font face="Courier New"><b>    plot.figure = fig</b></font></div></div><div style="color:rgb(0,0,0);margin:0px"><div style="margin:0px"><font face="Courier New"><b>    plot.axes = grid[i].axes</b></font></div></div><div style="color:rgb(0,0,0);margin:0px"><div style="margin:0px"><font face="Courier New"><b>    ##plot['temperature'].axes.set_title(zStr, fontsize=14) # Error</b></font></div></div><div style="color:rgb(0,0,0);margin:0px"><div style="margin:0px"><font face="Courier New"><b>    ##plot.axes.set_title(zStr, fontsize=14) # NOTHING, but doesn't error</b></font></div></div><div style="color:rgb(0,0,0);margin:0px"><div style="margin:0px"><font face="Courier New"><b>    ##plot.annotate_text(-7.0,10.0, zStr, **{'fontsize':20}) # Error</b></font></div></div><div style="color:rgb(0,0,0);margin:0px"><div style="margin:0px"><font face="Courier New"><b>    plot.cax = grid.cbar_axes[i]</b></font></div></div><div style="color:rgb(0,0,0);margin:0px"><div style="margin:0px"><font face="Courier New"><b>    plot.axes.set_title(zStr)</b></font></div></div><div style="color:rgb(0,0,0);margin:0px"><div style="margin:0px"><font face="Courier New"><b><br></b></font></div></div><div style="color:rgb(0,0,0);margin:0px"><div style="margin:0px"><font face="Courier New"><b>    # Finally, this actually redraws the plot.</b></font></div></div><div style="color:rgb(0,0,0);margin:0px"><div style="margin:0px"><font face="Courier New"><b>    p._setup_plots()</b></font></div></div><div style="color:rgb(0,0,0);margin:0px"><div style="margin:0px"><font face="Courier New"><b>p.show()</b></font></div></div></blockquote><div style="color:rgb(0,0,0);margin:0px"><div style="font-family:Helvetica,Arial;font-size:13px;margin:0px"><br></div><div style="font-family:Helvetica,Arial;font-size:13px;margin:0px">Thx again.</div></div> <br> <div><div style="font-family:helvetica,arial;font-size:13px"><div style="font-family:'helvetica Neue',helvetica"><i><font size="3">Cheers!</font></i></div><div style="font-family:'helvetica Neue',helvetica"><i><font size="3"><br></font></i></div><div style="font-family:'helvetica Neue',helvetica"><i><font size="3">Rick Sarmento</font></i></div><div style="font-family:'helvetica Neue',helvetica">SESE Astronomy/Astrophysics Grad Student</div><div style="font-family:'helvetica Neue',helvetica"><a href="mailto:rsarment@asu.edu" target="_blank">rsarment@asu.edu</a></div><div><br></div></div></div> <blockquote type="cite"><span><div style="word-wrap:break-word"><div><div><br></div>


</div></div></span></blockquote></div><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></blockquote></div><br></div>