Recipes/CubicProjection

Sometimes it's more appropriate to project only through a subset of a region. If you wanted to take the density-weighted average of Density through a cube and then plot that cube, you can do that with this snippet of code.

from yt.mods import *

pf = load("my_data0001")
v, c = pf.h.find_max("Density")
c = na.array(c)

pc = PlotCollection(pf, center=c)
reg = pf.h.region(c, c-1500/pf['au'], c+1500/pf['au'])
pc.add_projection("Density", 0, "Density", source=reg)
pc.set_width(3000, 'au')
pc.save('%s_3000AU_cube' % pf)