yt.visualization.image_writer.write_projection

yt.visualization.image_writer.write_projection(data, filename, colorbar=True, colorbar_label=None, title=None, limits=None, take_log=True, figsize=(8, 6), dpi=100, cmap_name='algae', extent=None, xlabel=None, ylabel=None)[source]

Write a projection or volume rendering to disk with a variety of pretty parameters such as limits, title, colorbar, etc. write_projection uses the standard matplotlib interface to create the figure. N.B. This code only works after you have created the projection using the standard framework (i.e. the Camera interface or off_axis_projection).

Accepts an NxM sized array representing the projection itself as well as the filename to which you will save this figure. Note that the final resolution of your image will be a product of dpi/100 * figsize.

Parameters:

data : array_like

image array as output by off_axis_projection or camera.snapshot()

filename : string

the filename where the data will be saved

colorbar : boolean

do you want a colorbar generated to the right of the image?

colorbar_label : string

the label associated with your colorbar

title : string

the label at the top of the figure

limits : 2-element array_like

the lower limit and the upper limit to be plotted in the figure of the data array

take_log : boolean

plot the log of the data array (and take the log of the limits if set)?

figsize : array_like

width, height in inches of final image

dpi : int

final image resolution in pixels / inch

cmap_name : string

The name of the colormap.

Examples

>>> image = off_axis_projection(ds, c, L, W, N, "Density", no_ghost=False)
>>> write_projection(image, 'test.png', 
                     colorbar_label="Column Density (cm$^{-2}$)", 
                     title="Offaxis Projection", limits=(1e-5,1e-3), 
                     take_log=True)