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:
objectThe SpectrumPlot class is for simple plotting of a
Spectrumusing 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 theplot()method will stay set until changed or reset using thereset()method.- Parameters:
- spectrum
Spectrum The spectrum to plot
- **kwargsdict
Plot attribute keyword arguments, see below.
- spectrum
- 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)
- xaxis_unitstr or
- Attributes:
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
Axesobject
- property figure
The underlying
Figureobject
- plot(**kwargs)[source]
Plot the spectrum.
- Parameters:
- **kwargsvarious
keyword=value arguments (need to describe these in a central place)
- property spectrum
The underlying
Spectrum