spacepy.plot.spectrogram.spectrogram

class spacepy.plot.spectrogram.spectrogram(data, **kwargs)[source]

This class rebins data to produce a 2D data map that can be plotted as a spectrogram

It is meant to be used on arbitrary data series. The first series “x” is plotted on the abscissa and second series “y” is plotted on the ordinate and the third series “z” is plotted in color.

The series are not passed in independently but instead inside a SpaceData container.

Parameters:

data : SpaceData

The data for the spectrogram, the variables to be used default to “Epoch” for x, “Energy” for y, and “Flux” for z. Other names are specified using the ‘variables’ keyword. All keywords override .attrs contents.

Other Parameters:
 

variables : list

keyword containing the names of the variables to use for the spectrogram the list is a list of the SpaceData keys in x, y, z, order

bins : list

if the name “bins” is not specified in the .attrs of the dmarray variable this specifies the bins for each variable in a [[xbins], [ybins]] format

xlim : list

if the name “lim” is not specified in the .attrs of the dmarray variable this specifies the limit for the x variable [xlow, xhigh]

ylim : list

if the name “lim” is not specified in the .attrs of the dmarray variable this specifies the limit for the y variable [ylow, yhigh]

zlim : list

if the name “lim” is not specified in the .attrs of the dmarray variable this specifies the limit for the z variable [zlow, zhigh]

extended_out : bool (optional)

if this is True add more information to the output data model (default True)

Notes

Helper routines are planned to facilitate the creation of the SpaceData container if the data are not in the format.

Examples

>>> import spacepy.datamodel as dm
>>> import numpy as np
>>> import spacepy.plot as splot
>>> sd = dm.SpaceData()
>>> sd['radius'] = dm.dmarray(2*np.sin(np.linspace(0,30,500))+4, attrs={'units':'km'})
>>> sd['day_of_year'] = dm.dmarray(np.linspace(74,77,500))
>>> sd['1D_dataset'] = dm.dmarray(np.random.normal(10,3,500)*sd['radius'])
>>> spec = splot.spectrogram(sd, variables=['day_of_year', 'radius', '1D_dataset'])
>>> ax = spec.plot()
plot([target, loc, figsize]) Plot the spectrogram
plot(target=None, loc=111, figsize=None, **kwargs)[source]

Plot the spectrogram

Other Parameters:
 

title : str

plot title (default ‘’)

xlabel : str

x axis label (default ‘’)

ylabel : str

y axis label (default ‘’)

colorbar_label : str

colorbar label (default ‘’)

DateFormatter : matplotlib.dates.DateFormatter

The formatting to use on the dates on the x-axis (default matplotlib.dates.DateFormatter(“%d %b %Y”))

zlog : bool

plot the z variable on a log scale (default True)

cmap : matplotlib Colormap

colormap instance to use

colorbar : bool

plot the colorbar (default True)

axis : matplotlib axis object

axis to plot the spectrogram to

zlim : np.array

array like 2 element that overrides (interior) the spectrogram zlim (default spectrogram.specSettings[‘zlim’])

figsize : tuple (optional)

tuple of size to pass to figure(), None does the default