I am trying to mask out the bound density of a system with the masking field
@derived_field(name = "bound_density", units = "g/cm**3")
def _get_ejected_density(field, data):
E = 0.5* data["cell_mass"]* (data["velx"]**2+data["vely"]**2+data["velz"]**2)+ data["gpot"]*data["cell_mass"]
return ((np.array(E)<0)*1)*data["density"]
It also returns the unbound density with the white color bars along with the bound density, but I don't want to show the unbound things here.
I was wondering if there is a way I can only show the bound material in this plot. Also another solution would be setting the unbound density color bar matching to the floor bar, hence 1.0e0, so that while the plot still shows the unbound density, it exactly matches the lowest density color bar in the plot and thus cannot be distinguished.
Here's an example that shows how to manipulate the colorbar so the background color matches the color at the bottom of the colorbar: