Hello all,

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?

# fractional=True keyword -- divide the profile data by the sum. 
fns = [ "/Users/earnric/RAMSES-Data/coolingFixedTau/output_00010/info_00010.txt",
       "/Users/earnric/RAMSES-Data/noCool/output_00010/info_00010.txt"]

fig = plt.figure()
grid = AxesGrid(fig, (0.075,0.075,0.85,0.85),
                nrows_ncols = (1, 2),
                axes_pad = 0.05,
                label_mode = "L",
                share_all = True,
                cbar_location="right",
                cbar_mode="single",
                cbar_size="3%",
                cbar_pad="0%")
fig.suptitle("Gas Phase")

for i, fn in enumerate(fns):
    ds = yt.load(fn)
    ad = ds.all_data()
    p = yt.PhasePlot(ad, "density", "temperature", "cell_mass", x_bins=256, y_bins=256, weight_field=None, fractional=True )
    plot = p.plots['cell_mass']
    if i % 2 == 0:
        ptype = "Gas phase ${H_2}$ cooling "
    else:
        ptype = "Gas phase Standard cooling "
    zStr = ptype + "z = %.1f" % ds.current_redshift 
    plot.figure = fig
    plot.axes = grid[i].axes
    plot.cax = grid.cbar_axes[i]
    #plot.annotate_title(zStr) # YOU HAVE TO DO THIS AFTER THE AXES calls

    p['cell_mass'].axes.set_ylim (1e-1, 1e6)
    p['cell_mass'].axes.set_xlim (1e-29, 1e-24)
    p['cell_mass'].axes.set_title(zStr, fontsize=20)
p.show()


Cheers,

Rick Sarmento