Hi guys,

I want a 2x2 multiplot showing 4 different things (density, temperature, HII fraction and radiation force). How do i get 4 different colorbars on a 2x2 image? currently it will only give me two.



my scripts as it stands:

from yt.mods import * # set up our namespace
import matplotlib.colorbar as cb
import os

orient = 'horizontal'
frame_template = "aaSN/%s/Multiplotproj_%02ipc_%01i_%04i.eps"

ss = float(sys.argv[2])
rho_min = 1.e-25
rho_max = 1.e-20
temp_min = 1
temp_max = 10000
HII_min = 1.e-5
HII_max = 1.0
rp_min = 1e24
rp_max = 1e26
name = sys.argv[1]

firststar = 0

def _ConvertAccel(data):
    return data.convert("Length") / (data.convert("Time"))**2.0
def _RadiationAccelerationMagnitude(field, data):
    return ( (data["RadAccel1"])**2.0 + \
             (data["RadAccel2"])**2.0 + \
             (data["RadAccel3"])**2.0 )**(1.0/2.0)
add_field("RadiationAccelerationMagnitude", function=_RadiationAccelerationMagnitude, take_log=False,convert_function=_ConvertAccel, units=r"\rm{cm}/\rm{s}^{2}")
def _RadiationForceMagnitude(field, data):
    return ( data["RadiationAccelerationMagnitude"] * data["Density"] * data["CellVolume"])
add_field("RadiationForceMagnitude", function=_RadiationForceMagnitude, take_log=False, units=r"\rm{dynes}")

for n in range(50,100,10):
    pf = load("SciNet/%s/DD%04i/data%04i" % (name,n, n)) # load data
    if pf is None: continue
    for ax in range (0,1):
        if os.path.exists(frame_template % (name,ss,ax,n)) is True:
            print "file exists"
        xc = 0.5
        yc = 0.5
        zc = 0.5  
        print "Dump:", n, "axis:", ax

        fig, axes, colorbars = get_multi_plot( 2, 2, colorbar=orient, bw = 6)

        pc = PlotCollection(pf, center=(xc, yc, zc))

        p = pc.add_projection("Density", ax,  weight_field="Density", figure = fig, axes = axes[0][0], use_colorbar=False)
        p.set_zlim(rho_min, rho_max)
        q = pc.add_projection("Temperature", ax, weight_field="Density", figure=fig, axes=axes[0][1], use_colorbar=False)
        q.set_zlim(temp_min, temp_max)
        r = pc.add_projection("HII_Fraction", ax, weight_field="Density", figure=fig, axes=axes[1][0], use_colorbar=False)
        r.set_zlim(HII_min, HII_max)
        s = pc.add_projection("RadiationForceMagnitude", ax, weight_field="Density", figure=fig, axes=axes[1][1], use_colorbar=False)
        s.set_zlim(rp_min, rp_max)
        pc.set_width(ss, 'pc')
        sp = pf.h.all_data()
        if na.any(pf.h.grid_particle_count):
            p.modify["particles"](2.0, p_size=1.0, col='k', minimum_mass= 6.e0)
            q.modify["particles"](2.0, p_size=1.0, col='k', minimum_mass= 6.e0)
            r.modify["particles"](2.0, p_size=1.0, col='k', minimum_mass= 6.e0)
            s.modify["particles"](2.0, p_size=1.0, col='k', minimum_mass= 6.e0)
           print "          XXXXX Particles present XXXXX"
        Timemyr = pf["InitialTime"]*pf["years"]/1.e6 - firststar*.1
        p.modify["text"]((0.051,0.949),"Time = %5.1f Myr" % (Timemyr), text_args = {'color':'k'})
        p.modify["text"]((0.05,0.95),"Time = %5.1f Myr" % (Timemyr), text_args = {'color':'w'})

        for p, cax in zip(pc.plots, colorbars):
            cbar = cb.Colorbar(cax, p.image, orientation=orient)
            p.colorbar = cbar

        fig.savefig(frame_template % (name,ss,ax,n), format="eps")

Elizabeth Harper-Clark MA MSci
PhD Candidate, Canadian Institute for Theoretical Astrophysics, UofT
Sciences and Engineering Coordinator, Teaching Assistants' Training Program, UofT

Astronomy office phone: +1-416-978-5759