Plotting classes and functions

Classes and functions for plotting spectra and SDFITS data

SpecPlot

Plot a spectrum using matplotlib

class dysh.plot.specplot.SpectrumPlot(spectrum, **kwargs)[source]

Bases: object

The SpectrumPlot class is for simple plotting of a Spectrum using matplotlib functions. Plots attributes are modified using keywords (**kwargs) described below SpectrumPlot will attempt to make smart default choices for the plot if no additional keywords are given. The attributes are “sticky” meaning that an attribute set via instantiation or by the plot() method will stay set until changed or reset using the reset() method.

Parameters:
spectrumSpectrum

The spectrum to plot

**kwargsdict

Plot attribute keyword arguments, see below.

Other Parameters:
xaxis_unitstr or Unit

The units to use on the x-axis, e.g. “km/s” to plot velocity

yaxis_unitstr or Unit

The units to use on the y-axis

xminfloat

Minimum x-axis value

xmaxfloat

Maximum x-axis value

yminfloat

Minimum y-axis value

ymaxfloat

Maximum y-axis value

xlabelstr

x-axis label

ylabelstr

y-axis label

gridbool

Show a plot grid or not

figsizetuple

Figure size (see matplotlib)

linewidthfloat

Line width, default: 2.0. lw also works

linestylestr

Line style, default ‘steps-mid’. ls also works

colorstr

Line color, c also works

titlestr

Plot title

aspectstr

plot aspect ratio, default: ‘auto’

show_baselinebool

show the baseline - not yet implemented

vel_framestr

The velocity frame (see VELDEF FITS Keyword)

vel_convention: str

The velocity convention (see VELDEF FITS Keyword)

Attributes:
axis

The underlying Axes object

figure

The underlying Figure object

spectrum

The underlying Spectrum

Methods

plot(**kwargs)

Plot the spectrum.

refresh()

Refresh the plot

reset()

Reset the plot keyword arguments to their defaults.

savefig(file, **kwargs)

Save the plot

property axis

The underlying Axes object

property figure

The underlying Figure object

plot(**kwargs)[source]

Plot the spectrum.

Parameters:
**kwargsvarious

keyword=value arguments (need to describe these in a central place)

refresh()[source]

Refresh the plot

reset()[source]

Reset the plot keyword arguments to their defaults.

savefig(file, **kwargs)[source]

Save the plot

property spectrum

The underlying Spectrum