%matplotlib inline from yt.mods import * from yt.visualization.color_maps import yt_colormaps from IPython.html.widgets import interact from IPython.display import display shape = [64,64,64] ds = load_uniform_grid({'Density': np.random.random(shape)}, shape, 1.0) ds.h center = ds.domain_center cam_L = np.ones(3, dtype='float') cam_W = ds.domain_width cam_R = 256 ds.field_info['Density'].take_log=False tf = ColorTransferFunction((0,1), grey_opacity=False) tf.map_to_colormap(0,1,scale=0.1, colormap='RdBu_r') cam = ds.h.camera(center, cam_L, cam_W, cam_R, transfer_function=tf, north_vector=np.array([0,0,1.]), l_max=None, sub_samples=2, no_ghost=True, ) @interact(mi = (0,1,0.1), ma = (0,1,0.1), logalpha = (-2, 2, 0.1), logwidth=(-2,0,0.1), cmap=yt_colormaps, auto_update=True, resolution=(128, 1024, 128)) def view(mi, ma, logalpha, cmap, auto_update, logwidth, resolution): cam.transfer_function.clear() cam.resolution=np.array([resolution]*2) cam.transfer_function.map_to_colormap(mi, ma, scale=10**logalpha, colormap=cmap) cam.switch_view(width=10**logwidth) if auto_update: cam.show()