make_spectral_plot

sofia_redux.visualization.quicklook.make_spectral_plot(axis, wavelength, spectral_flux, spectral_error=None, labels=None, scale=None, colormap='viridis', xunit=None, yunit=None, title=None, marker=None, marker_color='gray', overplot=None, overplot_label=None, overplot_color='gray', watermark=None)[source]

Generate a plot of spectral data.

Given a Matplotlib axis, this function adds one or more spectral plots to it, with optional error shading, overplots, markers, and axis labels.

The input data should be passes as arrays. If labels are not provided, then wavelength and spectral flux are passed directly to the step function to plot, and should follow input rules for that function.

If labels are passed, then it is assumed special handling is desired for multiple spectra. In this case, the first dimension of labels, wavelength, spectral_flux, and spectral_error (if passed) must match, so that they can be iterated together. If more than 15 spectra are passed in this manner, the labels are truncated to make the associated legend fit in the plot.

Parameters:
axismatplotlib.axes.Axes

Axis instance to add the plot to.

wavelengtharray-like

May be one-dimensional (nw), or (ns, nw) if ns labels are passed.

spectral_fluxarray-like

Must match wavelength dimensions.

spectral_errorarray-like, optional

Must match wavelength dimensions if provided.

labelslist of str, optional

Labels for multiple spectra, to display in a legend. Must have length ns, matching spectral data with dimensions (ns, nw).

scalelist of float, optional

Low and high percentile values to use to set the plot scale. If not provided, Matplotlib defaults are used.

colormapstr, optional

Matplotlib color map name. If a single spectrum is passed colormap[0] is used for the color. If multiple are passed, their colors are distributed evenly across the colormap.

xunitstr, optional

Wavelength units for the x-axis label. If xunit = cm-1, then the label is set to ‘Wavenumber’. Otherwise, it is ‘Wavelength’.

yunitstr, optional

Flux units for the y-axis label.

titlestr, optional

Title for the plot

markerlist of list, optional

If provided, should be [x, y], where x and y are matching lists of x- and y- coordinate values to place a marker at.

marker_colorstr, optional

Matplotlib color name for the marker, if provided.

overplotarray-like, optional

If provided, will be plotted as a thin line on a secondary y-axis. Should be provided as [x, y], where x is in the same units as wavelength.

overplot_labelstr, optional

Label for the overplot y-axis.

overplot_colorstr, optional

Matplotlib color name for the overplot line.

watermarkstr, optional

If provided, the string will be added as semi-transparent text in the lower-right corner of the plot.