Plotting Module¶
The classes and methods in gbm.plot
are for plotting and visualizing the
GBM science and auxiliary data.
Base Classes¶
These base classes define specialized plot element and a collection of various plot elements (forming a plot), respectively.
GbmPlotElement¶
- class gbm.plot.gbmplot.GbmPlotElement(color=None, alpha=None)[source]¶
Bases:
object
A base class representing a plot element. A plot element can be a complex collection of more primitive matplotlib plot elements, but are treated as a single element.
Note
This class is not intended to be instantiated directly by the user, rather it is inherited by child plot element objects.
- Parameters
alpha (float) – The alpha opacity value, between 0 and 1.
color (str) – The color of the plot element
- Attributes
alpha (float) – The alpha opacity value, between 0 and 1.
color (str) – The color of the plot element.
Note
Inherited classes may have sub-elements that can have different colors (and alphas). For those classes, refer to their specifications as to the definition of
color
.visible (bool) – True if the element is shown on the plot, False otherwise
GbmPlot¶
- class gbm.plot.gbmplot.GbmPlot(figsize=None, dpi=100, canvas=None, interactive=True, axis=None, **kwargs)[source]¶
Bases:
object
Base for plots of GBM data.
Note
This class is not intended to be instantiated directly by the user, rather it is inherited by different plot classes.
- Parameters
figsize ((float, float), optional) – The figure size (width, height)
dpi (int, optional) – The resolution of the plot. Default is 100
canvas (Canvas Backend object, optional) – If interfacing with a backend (e.g. Tk), pass the relavant Canvas Backend object and the master widget window. If not set, uses the default the matplotlib backend.
interactive (bool, optional) – If True, then enables interactive plotting (python environment is available while plot is displayed). Default is True. This is overriden if canvas is set.
axis (
matplotlib.axes
, optional) – An existing axes object to plot to. If not set, will create a new axes object.**kwargs – Additional options for Figure.add_subplot.
- Attributes
ax (
matplotlib.axes
) – The matplotlib axes object for the plotcanvas (Canvas Backend object) – The plotting canvas, if set upon initialization.
fig (
matplotlib.figure
) – The matplotlib figure objectxlim (float, float) – The plotting range of the x axis. This attribute can be set.
xscale (str) – The scale of the x axis, either ‘linear’ or ‘log’. This attribute can be set.
ylim (float, float) – The plotting range of the y axis. This attribute can be set.
yscale (str) – The scale of the y axis, either ‘linear’ or ‘log’. This attribute can be set.
GBM Plot Classes¶
These classes inherit from GbmPlot
and represent
standard visualizations of GBM science data and auxiliary data.
Lightcurve¶
- class gbm.plot.Lightcurve(data=None, background=None, canvas=None, axis=None, **kwargs)[source]¶
Bases:
gbm.plot.gbmplot.GbmPlot
Class for plotting lightcurves and lightcurve paraphernalia.
- Parameters
data (
TimeBins
, optional) – The lightcurve data to plotbackground (
BackgroundRates
, optional) – The background rates to plot**kwargs – Options to pass to
GbmPlot
- Attributes
ax (
matplotlib.axes
) – The matplotlib axes object for the plotbackground (
LightcurveBackground
) – The background plot elementcanvas (Canvas Backend object) – The plotting canvas, if set upon initialization.
errorbars (
HistoErrorbars
) – The error bars plot elementfig (
matplotlib.figure
) – The matplotlib figure objectlightcurve (
Histo
) – The lightcurve plot elementselections (list of
HistoFilled
) – The list of selection plot elementsxlim (float, float) – The plotting range of the x axis. This attribute can be set.
xscale (str) – The scale of the x axis, either ‘linear’ or ‘log’. This attribute can be set.
ylim (float, float) – The plotting range of the y axis. This attribute can be set.
yscale (str) – The scale of the y axis, either ‘linear’ or ‘log’. This attribute can be set.
- add_selection(data)[source]¶
Add a selection to the plot. This adds a new selection to a list of existing selections.
- Parameters
data (
TimeBins
) – The lightcurve data selection to plot
- set_background(background)[source]¶
Set the background plotting data. If a background already exists, this triggers a replot of the background.
- Parameters
background (
BackgroundRates
) – The background model to plot
Spectrum¶
- class gbm.plot.Spectrum(data=None, background=None, canvas=None, **kwargs)[source]¶
Bases:
gbm.plot.gbmplot.GbmPlot
Class for plotting count spectra and count spectra paraphernalia.
- Parameters
data (
EnergyBins
, optional) – The count spectrum data to plotbackground (
BackgroundSpectrum
, optional) – The background spectrum to plot**kwargs – Options to pass to
GbmPlot
- Attributes
ax (
matplotlib.axes
) – The matplotlib axes object for the plotbackground (
SpectrumBackground
) – The count spectrum background plot elementcanvas (Canvas Backend object) – The plotting canvas, if set upon initialization.
errorbars (
HistoErrorbars
) – The error bars plot elementfig (
matplotlib.figure
) – The matplotlib figure objectselections (
HistoFilled
) – The count spectrum selection plot elementspectrum (
Histo
) – The count spectrum plot elementxlim (float, float) – The plotting range of the x axis. This attribute can be set.
xscale (str) – The scale of the x axis, either ‘linear’ or ‘log’. This attribute can be set.
ylim (float, float) – The plotting range of the y axis. This attribute can be set.
yscale (str) – The scale of the y axis, either ‘linear’ or ‘log’. This attribute can be set.
- add_selection(data)[source]¶
Add a selection to the plot. This adds a new selection to a list of existing selections.
- Parameters
data (
EnergyBins
) – The count spectrum data selections to plot
- set_background(background)[source]¶
Set the background plotting data. If a background already exists, this triggers a replot of the background.
- Parameters
background (
BackgroundSpectrum
) – The background spectrum to plot
- set_data(data)[source]¶
Set the count spectrum plotting data. If a count spectrum already exists, this triggers a replot of the count spectrum.
- Parameters
data (
EnergyBins
) – The count spectrum data to plot
ModelFit¶
- class gbm.plot.ModelFit(fitter=None, canvas=None, view='counts', resid=True, interactive=True)[source]¶
Bases:
gbm.plot.gbmplot.GbmPlot
Class for plotting spectral fits.
- Parameters
fitter (
SpectralFitter
, optional) – The spectral fitterview (str, optional) – The plot view, one of ‘counts’, ‘photon’, ‘energy’ or ‘nufnu’. Default is ‘counts’
resid (bool, optional) – If True, plots the residuals in counts view. Default is True.
**kwargs – Options to pass to
GbmPlot
- Attributes
ax (
matplotlib.axes
) – The matplotlib axes object for the plotcanvas (Canvas Backend object) – The plotting canvas, if set upon initialization.
count_data (Collection of
ModelData
) – The count data plot elementscount_models (Collection of
Histo
) – The count model plot elementsfig (
matplotlib.figure
) – The matplotlib figure objectmodel_spectrum (Collection of
ModelSamples
) – The model spectrum sample elementsresiduals (Collection of
ModelData
) – The fit residual plot elementsview (str) – The current plot view
xlim (float, float) – The plotting range of the x axis. This attribute can be set.
xscale (str) – The scale of the x axis, either ‘linear’ or ‘log’. This attribute can be set.
ylim (float, float) – The plotting range of the y axis. This attribute can be set.
yscale (str) – The scale of the y axis, either ‘linear’ or ‘log’. This attribute can be set.
- energy_spectrum(**kwargs)[source]¶
Plot the energy spectrum model
- Parameters
num_samples (int, optional) – The number of sample spectra. Default is 100.
- nufnu_spectrum(**kwargs)[source]¶
Plot the nuFnu spectrum model
- Parameters
num_samples (int, optional) – The number of sample spectra. Default is 100.
- photon_spectrum(**kwargs)[source]¶
Plot the photon spectrum model
- Parameters
num_samples (int, optional) – The number of sample spectra. Default is 10.
- set_fit(fitter, resid=False)[source]¶
Set the fitter. If a fitter already exists, this triggers a replot of the fit.
- Parameters
fitter (
SpectralFitter
) – The spectral fitter for which a fit has been performedresid (bool, optional) – If True, plot the fit residuals
ResponseMatrix¶
- class gbm.plot.ResponseMatrix(data=None, colorbar=True, multi=False, canvas=None, axis=None, num_contours=100, **kwargs)[source]¶
Bases:
gbm.plot.gbmplot.GbmPlot
Class for plotting a response matrix.
- Parameters
data (
RSP
, optional) – The response objectcolorbar (bool, optional) – If True, plot the colorbar for the effective area scale. Default is True.
multi (bool, optional) – If True, plots a multiplot window showing the matrix and the integrated effective area as a function of incident energy and recorded energy
num_contours (int, optional) – Number of contours to plot. Default is 100
**kwargs – Options to pass to
GbmPlot
- Attributes
ax (
matplotlib.axes
) – The matplotlib axes object for the plotcanvas (Canvas Backend object) – The plotting canvas, if set upon initialization.
data ( – class:`~gbm.plot.gbmplot.HeatMap’): The matrix plot object
fig (
matplotlib.figure
) – The matplotlib figure objectxlim (float, float) – The plotting range of the x axis. This attribute can be set.
xscale (str) – The scale of the x axis, either ‘linear’ or ‘log’. This attribute can be set.
ylim (float, float) – The plotting range of the y axis. This attribute can be set.
yscale (str) – The scale of the y axis, either ‘linear’ or ‘log’. This attribute can be set.
PhotonEffectiveArea¶
- class gbm.plot.PhotonEffectiveArea(data=None, canvas=None, axis=None, **kwargs)[source]¶
Bases:
gbm.plot.gbmplot.GbmPlot
Class for plotting the incident photon effective area
- Parameters
- Attributes
ax (
matplotlib.axes
) – The matplotlib axes object for the plotcanvas (Canvas Backend object) – The plotting canvas, if set upon initialization.
data (
EffectiveArea
) – The effective area plot objectfig (
matplotlib.figure
) – The matplotlib figure objectxlim (float, float) – The plotting range of the x axis. This attribute can be set.
xscale (str) – The scale of the x axis, either ‘linear’ or ‘log’. This attribute can be set.
ylim (float, float) – The plotting range of the y axis. This attribute can be set.
yscale (str) – The scale of the y axis, either ‘linear’ or ‘log’. This attribute can be set.
- set_response(data, index=None, atime=None, **kwargs)[source]¶
Set the response data.
- Parameters
data (
RSP
) – The response objectindex (int, optional) – The index of the DRM to display
atime (float, optional) – The time corresponding to a DRM
**kwargs – Arguments to pass to
EffectiveArea
ChannelEffectiveArea¶
- class gbm.plot.ChannelEffectiveArea(data=None, canvas=None, axis=None, orientation='vertical', **kwargs)[source]¶
Bases:
gbm.plot.gbmplot.GbmPlot
Class for plotting the recorded channel energy effective area.
- Parameters
- Attributes
ax (
matplotlib.axes
) – The matplotlib axes object for the plotcanvas (Canvas Backend object) – The plotting canvas, if set upon initialization.
data (
EffectiveArea
) – The effective area plot objectfig (
matplotlib.figure
) – The matplotlib figure objectxlim (float, float) – The plotting range of the x axis. This attribute can be set.
xscale (str) – The scale of the x axis, either ‘linear’ or ‘log’. This attribute can be set.
ylim (float, float) – The plotting range of the y axis. This attribute can be set.
yscale (str) – The scale of the y axis, either ‘linear’ or ‘log’. This attribute can be set.
- set_response(data, index=None, atime=None, **kwargs)[source]¶
Set the response data.
- Parameters
data (
RSP
) – The response objectindex (int, optional) – The index of the DRM to display
atime (float, optional) – The time corresponding to a DRM
**kwargs – Arguments to pass to
EffectiveArea
SkyPlot¶
- class gbm.plot.SkyPlot(canvas=None, projection='mollweide', flipped=True, **kwargs)[source]¶
Bases:
gbm.plot.gbmplot.GbmPlot
Class for plotting on the sky in equatorial coordinates
- Parameters
projection (str, optional) – The projection of the map. Default is ‘mollweide’
flipped (bool, optional) – If True, the RA axis is flipped, following astronomical convention. Default is True.
**kwargs – Options to pass to
GbmPlot
- Attributes
ax (
matplotlib.axes
) – The matplotlib axes object for the plotbackground_color (str) – The color of the plot background. This attribute can be set.
canvas (Canvas Backend object) – The plotting canvas, if set upon initialization.
canvas_color (str) – The color of the plotting canvas. This attribute can be set.
detectors (
Collection
ofDetectorPointing
) – The collection of detector plot elementsearth (
SkyCircle
) – The Earth plot elementfig (
matplotlib.figure
) – The matplotlib figure objectfontsize (int) – The font size of the text labels. This attribute can be set.
gc (
GalacticPlane
) – The reference to the galactic plane plot elementloc_contours – (
Collection
ofSkyLine
orSkyPolygon
): The localization contour plot elementsloc_posterior (
SkyHeatmap
) – The localization gradient plot elementsun (
Sun
) – The Sun plot elementtext_color (str) – The color of the text labels
- add_healpix(hpx, gradient=True, clevels=None, sun=True, earth=True, detectors='all', galactic_plane=True)[source]¶
Add HealPix object to plot a localization and optionally the location of the Earth, Sun, and detector pointings
- Parameters
hpx (
HealPix
) – The HealPix objectgradient (bool, optional) – If True, plots the posterior as a color gradient. If False, plot the posterior as color-filled confidence regions.
clevels (list of float, optional) – The confidence levels to plot contours. By default plots at the 1, 2, and 3 sigma level.
detectors ('all' or list) – A list of detectors or “all” to plot the pointings on the sky
earth (bool, optional) – If True, plot the Earth. Default is True.
sun (bool, optional) – If True, plot the Sun. Default is True.
galactic_plane (bool, optional) – If True, plot the Galactic plane. Default is True.
Note
Setting gradient=False when plotting an annulus may produce unexpected results at this time. It is suggested to use gradient=True for plotting annuli maps.
- add_poshist(data, trigtime=None, detectors='all', geo=True, sun=True, galactic_plane=True)[source]¶
Add a Position History or Trigdat object to plot the location of the Earth, Sun, and detector pointings
- Parameters
data (
PosHist
orTrigdat
) – A Position History or Trigdat objecttrigtime (float, optional) – If data is PosHist, set trigtime to a particular time of interest. The Trigdat trigger time overrides this
detectors ('all' or list) – A list of detectors or “all” to plot the pointings on the sky
geo (bool, optional) – If True, plot the Earth. Default is True.
sun (bool, optional) – If True, plot the Sun. Default is True.
galactic_plane (bool, optional) – If True, plot the Galactic plane. Default is True.
- plot_detector(x, y, det, radius=10.0, **kwargs)[source]¶
Plot a detector pointing
- Parameters
x (float) – The RA of the detector normal
y (float) – The Dec of the detector normal
det (str) – The detector name
radius (float, optional) – The radius of pointing, in degrees. Default is 10.0
**kwargs – Options to pass to
SkyCircle
- plot_earth(x, y, radius, **kwargs)[source]¶
Plot the Earth
- Parameters
x (float) – The RA of the geocenter
y (float) – The Dec of the geocenter
radius (float) – The radius of the Earth, in degrees
**kwargs – Options to pass to
SkyCircle
- plot_heatmap(heatmap, ra_array, dec_array, **kwargs)[source]¶
Plot a heatmap on the sky
- Parameters
heatmap (np.array) – A 2D array of values
ra_array (np.array) – The array of RA gridpoints
dec_array (np.array) – The array of Dec gridpoints
radius (float) – The radius of pointing, in degrees
**kwargs – Options to pass to
SkyHeatmap
FermiSkyPlot¶
- class gbm.plot.FermiSkyPlot(canvas=None, projection='mollweide', **kwargs)[source]¶
Bases:
gbm.plot.skyplot.SkyPlot
Class for plotting in Fermi spacecraft coordinates.
- Parameters
projection (str, optional) – The projection of the map. Default is ‘mollweide’
**kwargs – Options to pass to
GbmPlot
- Attributes
ax (
matplotlib.axes
) – The matplotlib axes object for the plotbackground_color (str) – The color of the plot background. This attribute can be set.
canvas (Canvas Backend object) – The plotting canvas, if set upon initialization.
canvas_color (str) – The color of the plotting canvas. This attribute can be set.
detectors (
Collection
ofSkyCircle
) – The collection of detector plot elementsearth (
SkyCircle
) – The Earth plot elementfig (
matplotlib.figure
) – The matplotlib figure objectfontsize (int) – The font size of the text labels. This attribute can be set.
gc (
GalacticPlane
) – The reference to the galactic plane plot elementloc_contours – (
Collection
ofSkyLine
orSkyPolygon
): The localization contour plot elementsloc_posterior (
SkyHeatmap
) – The localization gradient plot elementsun (
Sun
) – The Sun plot elementtext_color (str) – The color of the text labels
- add_poshist(data, trigtime=None, detectors='all', geo=True, sun=True, galactic_plane=True)[source]¶
Add a Position History or Trigdat object to plot the location of the Earth, Sun, and detector pointings
- Parameters
data (
PosHist
orTrigdat
) – A Position History or Trigdat objecttrigtime (float, optional) – If data is PosHist, set trigtime to a particular time of interest. The Trigdat trigger time overrides this
detectors ('all' or list) – A list of detectors or “all” to plot the pointings on the sky
geo (bool, optional) – If True, plot the Earth. Default is True.
sun (bool, optional) – If True, plot the Sun. Default is True.
galactic_plane (bool, optional) – If True, plot the Galactic plane. Default is True.
- plot_detector(det, radius=10.0, **kwargs)[source]¶
Plot a detector pointing
- Parameters
det (str) – The detector name
radius (float, optional) – The radius of pointing, in degrees. Default is 10.0
**kwargs – Options to pass to
SkyCircle
- plot_earth(x, y, radius, **kwargs)[source]¶
Plot the Earth
- Parameters
x (float) – The RA of the geocenter
y (float) – The Dec of the geocenter
radius (float) – The radius of the Earth, in degrees
**kwargs – Options to pass to
SkyCircle
- plot_galactic_plane(quat)[source]¶
Plot the Galactic plane
- Parameters
quat (np.array) – The Fermi attitude quaternion
- plot_heatmap(heatmap, ra_array, dec_array, **kwargs)¶
Plot a heatmap on the sky
- Parameters
heatmap (np.array) – A 2D array of values
ra_array (np.array) – The array of RA gridpoints
dec_array (np.array) – The array of Dec gridpoints
radius (float) – The radius of pointing, in degrees
**kwargs – Options to pass to
SkyHeatmap
EarthPlot¶
- class gbm.plot.EarthPlot(lat_range=None, lon_range=None, saa=True, mcilwain=True, canvas=None, **kwargs)[source]¶
Bases:
gbm.plot.gbmplot.GbmPlot
Class for plotting the Earth, primarily related to Fermi’s position in orbit.
Note
This class requires installation of Matplotlib Basemap.
- Parameters
lat_range ((float, float), optional) – The latitude range of the plot. Default value is the extent of the Fermi orbit: (-27, 27)
lon_range ((float, float), optional) – The longitude range of the plot. Default value is (-180, 180).
saa (bool, optional) – If True, display the SAA polygon. Default is True.
mcilwain (bool, optional) – If True, display the McIlwain L heatmap. Default is True.
**kwargs – Options to pass to
GbmPlot
- Attributes
ax (
matplotlib.axes
) – The matplotlib axes object for the plotcanvas (Canvas Backend object) – The plotting canvas, if set upon initialization.
fermi (
FermiIcon
) – Fermi spacecraft plot elementfig (
matplotlib.figure
) – The matplotlib figure objectmap (
mpl_toolkits.basemap.Basemap
) – The Basemap objectmcilwainl (
McIlwainL
) – The McIlwain L heatmaporbit (
EarthLine
) – The orbital path of Fermisaa (
SAA
) – The SAA polygon
- add_poshist(data, time_range=None, trigtime=None, numpts=1000)[source]¶
Add a Position History or Trigdat object to plot the orbital path of Fermi and optional the position of Fermi at a particular time.
- Parameters
data (
PosHist
orTrigdat
) – A Position History or Trigdat objecttime_range – ((float, float), optional) The time range over which to plot the orbit. If omitted, plots the orbit over the entire time range of the file.
trigtime (float, optional) – If data is PosHist, set trigtime to a particular time of interest to plot Fermi’s orbital location. The Trigdat trigger time overrides this.
numpts (int, optional) – The number of interpolation points for plotting the orbit. Default is 1000.
GBM Plot Element Classes¶
These classes inherit from GbmPlotElemant
and
represent individual standard plot elements.
Histo¶
- class gbm.plot.gbmplot.Histo(bins, ax, color=None, alpha=None, label=None, **kwargs)[source]¶
Bases:
gbm.plot.gbmplot.GbmPlotElement
Plot a rate histogram of either lightcurves or count spectra.
- Parameters
bins (
TimeBins
orEnergyBins
) – The lightcurve or count spectrum histogramsax (
matplotlib.axes
) – The axis on which to plotcolor (str, optional) – The color of the rate histograms
alpha (float, optional) – The alpha of the fill. Default is 1
**kwargs – Other plotting options
- Attributes
alpha (float) – The alpha opacity value, between 0 and 1.
color (str) – The color of the plot element.
visible (bool) – True if the element is shown on the plot, False otherwise
- hide()¶
Hide the plot element
- remove()¶
Remove the plot element
- show()¶
Show the plot element
- toggle()¶
Toggle the visibility of the plot element
HistoErrorbars¶
- class gbm.plot.gbmplot.HistoErrorbars(bins, ax, color=None, alpha=None, **kwargs)[source]¶
Bases:
gbm.plot.gbmplot.GbmPlotElement
Plot errorbars for lightcurves or count spectra.
- Parameters
bins (
TimeBins
orEnergyBins
) – The lightcurve or count spectrum histogramsax (
matplotlib.axes
) – The axis on which to plotcolor (str, optional) – The color of the rate histograms
alpha (float, optional) – The alpha of the fill. Default is 1
**kwargs – Other plotting options
- Attributes
alpha (float) – The alpha opacity value
color (str) – The color of the plot element.
visible (bool) – True if the element is shown on the plot, False otherwise
- hide()¶
Hide the plot element
- remove()¶
Remove the plot element
- show()¶
Show the plot element
- toggle()¶
Toggle the visibility of the plot element
HistoFilled¶
- class gbm.plot.gbmplot.HistoFilled(bins, ax, color=None, alpha=None, **kwargs)[source]¶
Bases:
gbm.plot.gbmplot.GbmPlotElement
Plot a filled histogram.
- Parameters
bins (
TimeBins
orEnergyBins
) – The lightcurve or count spectrum histogramsax (
matplotlib.axes
) – The axis on which to plotcolor (str, optional) – The color of the rate histograms
alpha (float, optional) – The alpha of the fill. Default is 1
**kwargs – Other plotting options
- Attributes
alpha (float) – The alpha opacity value
color (str) – The color of the plot element.
visible (bool) – True if the element is shown on the plot, False otherwise
- hide()¶
Hide the plot element
- remove()¶
Remove the plot element
- show()¶
Show the plot element
- toggle()¶
Toggle the visibility of the plot element
LightcurveBackground¶
- class gbm.plot.gbmplot.LightcurveBackground(backrates, ax, color=None, alpha=None, cent_alpha=None, err_alpha=None, cent_color=None, err_color=None, **kwargs)[source]¶
Bases:
gbm.plot.gbmplot.GbmPlotElement
Plot a lightcurve background model with an error band.
- Parameters
backrates (
BackgroundRates
) – The background rates object integrated over energy. If there is more than one remaining energy channel, the background will be integrated over the remaining energy channels.ax (
matplotlib.axes
) – The axis on which to plotcent_alpha (float, optional) – The alpha of the background centroid line. Default is 1
cent_color (str, optional) – The color of the background centroid line
err_alpha (float, optional) – The alpha of the background uncertainty. Default is 1
err_color (str, optional) – The color of the background uncertainty
color (str, optional) – The color of the background. If set, overrides
cent_color
anderr_color
.alpha (float, optional) – The alpha of the background. If set, overrides
cent_alpha
anderr_alpha
**kwargs – Other plotting options
- Attributes
alpha (float) – The alpha opacity value
cent_alpha (float) – The opacity of the centroid line
cent_color (str) – The color of the centroid line
color (str) – The color of the plot element.
err_alpha (float) – The opacity of the uncertainty band
err_color (str) – The color of the uncertainty band
visible (bool) – True if the element is shown on the plot, False otherwise
- hide()¶
Hide the plot element
- remove()¶
Remove the plot element
- show()¶
Show the plot element
- toggle()¶
Toggle the visibility of the plot element
SpectrumBackground¶
- class gbm.plot.gbmplot.SpectrumBackground(backspec, ax, color=None, alpha=None, cent_alpha=None, err_alpha=None, cent_color=None, err_color=None, **kwargs)[source]¶
Bases:
gbm.plot.gbmplot.GbmPlotElement
Plot a count spectrum background model with an error band.
- Parameters
backspec (
BackgroundSpectrum
) – The background sepctrum object integrated over timeax (
matplotlib.axes
) – The axis on which to plotcent_alpha (float, optional) – The alpha of the background centroid line. Default is 1
cent_color (str, optional) – The color of the background centroid line
err_alpha (float, optional) – The alpha of the background uncertainty. Default is 1
err_color (str, optional) – The color of the background uncertainty
color (str, optional) – The color of the background. If set, overrides
cent_color
anderr_color
.alpha (float, optional) – The alpha of the background. If set, overrides
cent_alpha
anderr_alpha
**kwargs – Other plotting options
- Attributes
alpha (float) – The alpha opacity value
cent_alpha (float) – The opacity of the centroid line
cent_color (str) – The color of the centroid line
color (str) – The color of the plot element.
err_alpha (float) – The opacity of the uncertainty band
err_color (str) – The color of the uncertainty band
visible (bool) – True if the element is shown on the plot, False otherwise
- hide()¶
Hide the plot element
- remove()¶
Remove the plot element
- show()¶
Show the plot element
- toggle()¶
Toggle the visibility of the plot element
HeatMap¶
- class gbm.plot.gbmplot.HeatMap(x, y, heatmap, ax, colorbar=True, color='Greens', alpha=None, alpha_min=0.0, alpha_max=1.0, norm=None, num_contours=100, **kwargs)[source]¶
Bases:
gbm.plot.gbmplot.GbmPlotElement
Plot a general heatmap (color gradient). By default, the heatmap opacity will scale from 0 (fully transparent) to 1 (fully opaque) corresponding to the colormap value, creating an opacity gradient. This behavior can be adjusted by setting
alpha_min
andalpha_max
.- Parameters
x (np.array) – The x-coordinate array of the heatmap grid
y (np.array) – The y-coordinate array of the heatmap grid
heatmap (np.array) – The heatmap array, of shape (
x.size
,y.size
)ax (
matplotlib.axes
) – The axis on which to plotcolorbar (bool, optional) – If True, add the colorbar scale. Default is True.
color (str, optional) – The colormap of the heatmap. Default is ‘Greens’
alpha_min (float, optional) – The alpha opacity for the minimum color value. Default is 0.
alpha_max (float, optional) – The alpha opacity for the maximum color value. Default is 1.
norm (
matplotlib.colors.Normalize
or similar, optional) – The normalization used to scale the colormapping to the heatmap values. This can be initialized by the defined matplotlib normalizations or a custom normalization.num_contours (int, optional) – The number of contour lines to draw. Default is 100.
**kwargs – Other plotting options
- Attributes
alpha_max (float) – The alpha opacity for the maximum color value
alpha_min (float) – The alpha opacity for the minimum color value
color (str) – The colormap
colorbar ( – class:`matplotlib.colorbar.Colorbar): The colorbar object
norm (
matplotlib.colors.Normalize
or similar) – The colormap normalizationvisible (bool) – True if the element is shown on the plot, False otherwise
- hide()¶
Hide the plot element
- remove()¶
Remove the plot element
- show()¶
Show the plot element
- toggle()¶
Toggle the visibility of the plot element
EffectiveArea¶
- class gbm.plot.gbmplot.EffectiveArea(bins, ax, color=None, alpha=None, orientation='vertical', **kwargs)[source]¶
Bases:
gbm.plot.gbmplot.GbmPlotElement
Plot a histogram of the effective area of a detector response.
- Parameters
bins (
Bins
) – The effective area histogramsax (
matplotlib.axes
) – The axis on which to plotcolor (str, optional) – The color of the rate histograms
alpha (float, optional) – The alpha of the histogram. Default is 1
**kwargs – Other plotting options
- Attributes
alpha (float) – The alpha opacity value, between 0 and 1.
color (str) – The color of the plot element.
visible (bool) – True if the element is shown on the plot, False otherwise
- hide()¶
Hide the plot element
- remove()¶
Remove the plot element
- show()¶
Show the plot element
- toggle()¶
Toggle the visibility of the plot element
SAA¶
- class gbm.plot.gbmplot.SAA(m, ax, color=None, alpha=None, **kwargs)[source]¶
Bases:
gbm.plot.gbmplot.GbmPlotElement
Plot the SAA polygon
- Parameters
m (
mpl_toolkits.basemap.Basemap
) – The basemap referenceax (
matplotlib.axes
) – The axis on which to plotcolor (str, optional) – The color of the SAA polygon
alpha (float, optional) – The alpha of the interior of the polygon
**kwargs – Other plotting options
- Attributes
alpha (float) – The alpha opacity value.
color (str) – The color of the polygon.
visible (bool) – True if the element is shown on the plot, False otherwise
- hide()¶
Hide the plot element
- in_saa(lon, lat)[source]¶
Check if a point or points is inside the SAA
- Parameters
lon (np.array) – longitudes
lat (np.array) – latitudes
- Returns
np.array – Boolean array for each point where True indicates the point is in the SAA.
- remove()¶
Remove the plot element
- show()¶
Show the plot element
- toggle()¶
Toggle the visibility of the plot element
McIlwainL¶
- class gbm.plot.gbmplot.McIlwainL(m, ax, colorbar=True, color=None, alpha=None, **kwargs)[source]¶
Bases:
gbm.plot.gbmplot.GbmPlotElement
Plot the McIlwain L heatmap
- Parameters
m (
mpl_toolkits.basemap.Basemap
) – The basemap referenceax (
matplotlib.axes
) – The axis on which to plotcolorbar (bool, optional) – If True, create a colorbar for the heatmap. Default is True
color (str, optional) – The colormap of the heatmap
alpha (float, optional) – The alpha opacity of the heatmap
**kwargs – Other plotting options
- Attributes
alpha (float) – The alpha opacity value.
color (str) – The colormap of the heatmap.
visible (bool) – True if the element is shown on the plot, False otherwise
- hide()¶
Hide the plot element
- remove()¶
Remove the plot element
- show()¶
Show the plot element
- toggle()¶
Toggle the visibility of the plot element
EarthLine¶
- class gbm.plot.gbmplot.EarthLine(lat, lon, m, ax, color=None, alpha=None, **kwargs)[source]¶
Bases:
gbm.plot.gbmplot.GbmPlotElement
Plot a line on the Earth
- Parameters
lat (np.array) – The latitude values of the line
lon (np.array) – The longitude values of the line
m (
mpl_toolkits.basemap.Basemap
) – The basemap referenceax (
matplotlib.axes
) – The axis on which to plotcolor (str, optional) – The color of the line
alpha (float, optional) – The alpha opacity of the line
**kwargs – Other plotting options
- Attributes
alpha (float) – The alpha opacity value.
color (str) – The color of the line.
visible (bool) – True if the element is shown on the plot, False otherwise
- hide()¶
Hide the plot element
- remove()¶
Remove the plot element
- show()¶
Show the plot element
- toggle()¶
Toggle the visibility of the plot element
EarthPoints¶
- class gbm.plot.gbmplot.EarthPoints(lat, lon, m, ax, color=None, alpha=None, **kwargs)[source]¶
Bases:
gbm.plot.gbmplot.GbmPlotElement
Plot a point or set of points on the Earth.
- Parameters
lat (np.array) – The latitude values
lon (np.array) – The longitude values
m (
mpl_toolkits.basemap.Basemap
) – The basemap referenceax (
matplotlib.axes
) – The axis on which to plotcolor (str, optional) – The color of the line
alpha (float, optional) – The alpha opacity of the line
**kwargs – Other plotting options
- Attributes
alpha (float) – The alpha opacity value.
color (str) – The color of the points.
coordinates (list of str) – The formatted coordinate list of the points
visible (bool) – True if the element is shown on the plot, False otherwise
- hide()¶
Hide the plot element
- remove()¶
Remove the plot element
- show()¶
Show the plot element
- toggle()¶
Toggle the visibility of the plot element
FermiIcon¶
- class gbm.plot.gbmplot.FermiIcon(lat, lon, m, ax, color=None, alpha=None, **kwargs)[source]¶
Bases:
gbm.plot.gbmplot.EarthPoints
Plot a Fermi icon on the Earth.
- Parameters
lat (np.array) – The latitude value
lon (np.array) – The longitude value
m (
mpl_toolkits.basemap.Basemap
) – The basemap referenceax (
matplotlib.axes
) – The axis on which to plotalpha (float, optional) – The alpha opacity of the line
**kwargs – Other plotting options
- Attributes
alpha (float) – The alpha opacity value.
coordinates (list of str) – The formatted coordinate list of the points
visible (bool) – True if the element is shown on the plot, False otherwise
- hide()¶
Hide the plot element
- remove()¶
Remove the plot element
- show()¶
Show the plot element
- toggle()¶
Toggle the visibility of the plot element
SkyPoints¶
- class gbm.plot.gbmplot.SkyPoints(x, y, ax, flipped=True, fermi=False, color=None, alpha=None, **kwargs)[source]¶
Bases:
gbm.plot.gbmplot.GbmPlotElement
Plot a set of points on the sky in either equatorial coordinates or in spacecraft coordinates.
- Parameters
x (float or np.array) – The azimuthal coordinate (RA or Fermi azimuth), in degrees
y (float or np.array) – The polar coordinate (Dec or Fermi zenith), in degrees
ax (
matplotlib.axes
) – The axis on which to plotflipped (bool, optional) – If True, the azimuthal axis is flipped, following equatorial convention
fermi (bool, optional) – If True, plot in Fermi spacecraft coordinates, else plot in equatorial. Default is False.
color (str, optional) – The color of the points
alpha (float, optional) – The alpha opacity of the points
**kwargs – Other plotting options
- Attributes
alpha (float) – The alpha opacity value.
color (str) – The color of the points.
visible (bool) – True if the element is shown on the plot, False otherwise
- hide()¶
Hide the plot element
- remove()¶
Remove the plot element
- show()¶
Show the plot element
- toggle()¶
Toggle the visibility of the plot element
SkyLine¶
- class gbm.plot.gbmplot.SkyLine(x, y, ax, flipped=True, fermi=False, color=None, alpha=None, **kwargs)[source]¶
Bases:
gbm.plot.gbmplot.GbmPlotElement
Plot a line on the sky in either equatorial coordinates or in spacecraft coordinates.
- Parameters
x (np.array) – The azimuthal coordinate (RA or Fermi azimuth), in degrees
y (np.array) – The polar coordinate (Dec or Fermi zenith), in degrees
ax (
matplotlib.axes
) – The axis on which to plotflipped (bool, optional) – If True, the azimuthal axis is flipped, following equatorial convention
fermi (bool, optional) – If True, plot in Fermi spacecraft coordinates, else plot in equatorial. Default is False.
color (str, optional) – The color of the line
alpha (float, optional) – The alpha opacity of the line
**kwargs – Other plotting options
- Attributes
alpha (float) – The alpha opacity value.
color (str) – The color of the line
visible (bool) – True if the element is shown on the plot, False otherwise
- hide()¶
Hide the plot element
- remove()¶
Remove the plot element
- show()¶
Show the plot element
- toggle()¶
Toggle the visibility of the plot element
SkyCircle¶
- class gbm.plot.gbmplot.SkyCircle(x, y, radius, ax, flipped=True, fermi=False, color=None, alpha=None, face_color=None, face_alpha=None, edge_color=None, edge_alpha=None, **kwargs)[source]¶
Bases:
gbm.plot.gbmplot.GbmPlotElement
Plot a circle on the sky in either equatorial coordinates or in spacecraft coordinates.
Note
This class requires installation of Matplotlib Basemap.
- Parameters
x (float) – The azimuthal coordinate of the center (RA or Fermi azimuth), in degrees
y (float) – The polar coordinate of the center (Dec or Fermi zenith), in degrees
radius (float) – The radius of the circle, in degrees
ax (
matplotlib.axes
) – The axis on which to plotflipped (bool, optional) – If True, the azimuthal axis is flipped, following equatorial convention
fermi (bool, optional) – If True, plot in Fermi spacecraft coordinates, else plot in equatorial. Default is False.
face_color (str, optional) – The color of the circle fill
face_alpha (float, optional) – The alpha opacity of the circle fill
edge_color (str, optional) – The color of the circle edge
edge_alpha (float, optional) – The alpha opacity of the circle edge
color (str, optional) – The color of the circle. If set, overrides
face_color
andedge_color
.alpha (float, optional) – The alpha of the circle. If set, overrides
face_alpha
andedge_alpha
.**kwargs – Other plotting options
- Attributes
alpha (float) – The alpha opacity value.
color (str) – The color of the circle
edge_alpha (float) – The alpha opacity of the circle edge
edge_color (str) – The color of the circle edge
face_alpha (float) – The alpha opacity of the circle fill
face_color (str) – The color of the circle fill
visible (bool) – True if the element is shown on the plot, False otherwise
- hide()¶
Hide the plot element
- remove()¶
Remove the plot element
- show()¶
Show the plot element
- toggle()¶
Toggle the visibility of the plot element
SkyPolygon¶
- class gbm.plot.gbmplot.SkyPolygon(x, y, ax, flipped=True, fermi=False, color=None, alpha=None, face_color=None, face_alpha=None, edge_color=None, edge_alpha=None, **kwargs)[source]¶
Bases:
gbm.plot.gbmplot.GbmPlotElement
Plot a polygon on the sky in either equatorial coordinates or in spacecraft coordinates.
- Parameters
x (float) – The azimuthal coordinate (RA or Fermi azimuth), in degrees
y (float) – The polar coordinate (Dec or Fermi zenith), in degrees
ax (
matplotlib.axes
) – The axis on which to plotflipped (bool, optional) – If True, the azimuthal axis is flipped, following equatorial convention
fermi (bool, optional) – If True, plot in Fermi spacecraft coordinates, else plot in equatorial. Default is False.
face_color (str, optional) – The color of the polygon fill
face_alpha (float, optional) – The alpha opacity of the polygon fill
edge_color (str, optional) – The color of the polygon edge
edge_alpha (float, optional) – The alpha opacity of the polygon edge
color (str, optional) – The color of the polygon. If set, overrides
face_color
andedge_color
.alpha (float, optional) – The alpha of the polygon. If set, overrides
face_alpha
andedge_alpha
.**kwargs – Other plotting options
- Attributes
alpha (float) – The alpha opacity value.
color (str) – The color of the polygon
edge_alpha (float) – The alpha opacity of the polygon edge
edge_color (str) – The color of the polygon edge
face_alpha (float) – The alpha opacity of the polygon fill
face_color (str) – The color of the polygon fill
visible (bool) – True if the element is shown on the plot, False otherwise
- hide()¶
Hide the plot element
- remove()¶
Remove the plot element
- show()¶
Show the plot element
- toggle()¶
Toggle the visibility of the plot element
SkyAnnulus¶
- class gbm.plot.gbmplot.SkyAnnulus(x, y, radius, width, ax, flipped=True, fermi=False, color=None, alpha=None, **kwargs)[source]¶
Bases:
gbm.plot.gbmplot.GbmPlotElement
Plot an annulus on the sky in either equatorial coordinates or in spacecraft coordinates.
Note
This class requires installation of Matplotlib Basemap.
- Parameters
x (float) – The azimuthal center (RA or Fermi azimuth), in degrees
y (float) – The polar center (Dec or Fermi zenith), in degrees
radius (float) – The radius in degrees, defined as the angular distance from the center to the middle of the width of the annulus band.
width (float) – The width onf the annulus in degrees
ax (
matplotlib.axes
) – The axis on which to plotflipped (bool, optional) – If True, the azimuthal axis is flipped, following equatorial convention
fermi (bool, optional) – If True, plot in Fermi spacecraft coordinates, else plot in equatorial. Default is False.
color (str, optional) – The color of the annulus.
alpha (float, optional) – The opacity of the annulus.
**kwargs – Other plotting options
- Attributes
alpha (float) – The alpha opacity value.
color (str) – The color of the annulus
visible (bool) – True if the element is shown on the plot, False otherwise
- hide()¶
Hide the plot element
- remove()¶
Remove the plot element
- show()¶
Show the plot element
- toggle()¶
Toggle the visibility of the plot element
Sun¶
- class gbm.plot.gbmplot.Sun(x, y, ax, flipped=True, fermi=False, alpha=None, **kwargs)[source]¶
Bases:
gbm.plot.gbmplot.GbmPlotElement
Plot the sun on the sky.
- Parameters
x (float) – The azimuthal coordinate (RA or Fermi azimuth), in degrees
y (float) – The polar coordinate (Dec or Fermi zenith), in degrees
ax (
matplotlib.axes
) – The axis on which to plotflipped (bool, optional) – If True, the azimuthal axis is flipped, following equatorial convention
fermi (bool, optional) – If True, plot in Fermi spacecraft coordinates, else plot in equatorial. Default is False.
alpha (float, optional) – The opacity of the annulus.
**kwargs – Other plotting options
- Attributes
alpha (float) – The alpha opacity value.
visible (bool) – True if the element is shown on the plot, False otherwise
- hide()¶
Hide the plot element
- remove()¶
Remove the plot element
- show()¶
Show the plot element
- toggle()¶
Toggle the visibility of the plot element
DetectorPointing¶
- class gbm.plot.gbmplot.DetectorPointing(x, y, radius, det, ax, flipped=None, fermi=None, color='dimgray', edge_alpha=0.5, face_alpha=0.25, fontsize=10, font_alpha=0.8, **kwargs)[source]¶
Bases:
gbm.plot.gbmplot.SkyCircle
Plot a detector pointing on the sky in either equatorial coordinates or spacecraft coordinates.
- Parameters
x (float) – The azimuthal coordinate (RA or Fermi azimuth), in degrees
y (float) – The polar coordinate (Dec or Fermi zenith), in degrees
radius (float) – The radius of the circle, in degrees
ax (
matplotlib.axes
) – The axis on which to plotflipped (bool, optional) – If True, the azimuthal axis is flipped, following equatorial convention
fermi (bool, optional) – If True, plot in Fermi spacecraft coordinates, else plot in equatorial. Default is False.
face_color (str, optional) – The color of the circle fill
face_alpha (float, optional) – The alpha opacity of the circle fill
edge_color (str, optional) – The color of the circle edge
edge_alpha (float, optional) – The alpha opacity of the circle edge
color (str, optional) – The color of the circle. If set, overrides
face_color
andedge_color
.alpha (float, optional) – The alpha of the circle. If set, overrides
face_alpha
andedge_alpha
.fontsize (float, optional) – The size of the detector label
font_alpha (float, optional) – The alpha opacity of the detector label
**kwargs – Other plotting options
- Attributes
alpha (float) – The alpha opacity value.
color (str) – The color of the circle
edge_alpha (float) – The alpha opacity of the circle edge
edge_color (str) – The color of the circle edge
face_alpha (float) – The alpha opacity of the circle fill
face_color (str) – The color of the circle fill
fontsize (float) – The size of the detector label
font_alpha (float) – The alpha opacity of the detector label
visible (bool) – True if the element is shown on the plot, False otherwise
- hide()¶
Hide the plot element
- remove()¶
Remove the plot element
- show()¶
Show the plot element
- toggle()¶
Toggle the visibility of the plot element
GalacticPlane¶
- class gbm.plot.gbmplot.GalacticPlane(ax, flipped=True, fermi_quat=None, color=None, inner_color='black', outer_color='dimgray', alpha=None, line_alpha=0.5, center_alpha=0.75, **kwargs)[source]¶
Bases:
gbm.plot.gbmplot.GbmPlotElement
Plot the Galactic Plane in either equatorial coordinates or in spacecraft coordinates.
- Parameters
ax (
matplotlib.axes
) – The axis on which to plotflipped (bool, optional) – If True, the azimuthal axis is flipped, following equatorial convention
fermi (bool, optional) – If True, plot in Fermi spacecraft coordinates, else plot in equatorial. Default is False.
inner_color (str, optional) – The color of the inner line element
outer_color (str, optional) – The color of the outer line element
line_alpha (float, optional) – The alpha opacity of the line elements of the Galactic Plane
center_alpha (float, optional) – The alpha opacity of the Galactic center
color (str, optional) – The color of the Galactic plane. Overrides
inner_color
andouter_color
.alpha (float, optional) – The opacity of the Galactic plane. Overrides
line_alpha
andcenter_alpha
.**kwargs – Other plotting options
- Attributes
alpha (float) – The alpha opacity value.
center_alpha (float) – The alpha opacity of the Galactic plane
color (str) – The color of the Galactic plane
inner_color (str) – The color of the inner line element
line_alpha (float) – The alpha opacity of the line elements
outer_color (str) – The color of the outer line element
visible (bool) – True if the element is shown on the plot, False otherwise
- hide()¶
Hide the plot element
- remove()¶
Remove the plot element
- show()¶
Show the plot element
- toggle()¶
Toggle the visibility of the plot element
SkyHeatmap¶
- class gbm.plot.gbmplot.SkyHeatmap(x, y, heatmap, ax, flipped=True, fermi=False, color='RdPu', alpha=None, alpha_min=0.0, alpha_max=1.0, norm=None, **kwargs)[source]¶
Bases:
gbm.plot.gbmplot.GbmPlotElement
Plot a heatmap on the sky. By default, the heatmap opacity will scale from 0 (fully transparent) to 1 (fully opaque) corresponding to the colormap value, creating an alpha gradient. This behavior can be adjust by setting
alpha_min
andalpha_max
.- Parameters
x (np.array) – The azimuthal coordinate array of the heatmap grid
y (np.array) – The polar coordinate array of the heatmap grid
heatmap (np.array) – The heatmap array, of shape (
x.size
,y.size
)ax (
matplotlib.axes
) – The axis on which to plotcolor (str, optional) – The colormap of the heatmap. Default is ‘RdPu’
alpha_min (float, optional) – The alpha opacity for the minimum color value. Default is 0.
alpha_max (float, optional) – The alpha opacity for the maximum color value. Default is 1.
norm (
matplotlib.colors.Normalize
or similar, optional) – The normalization used to scale the colormapping to the heatmap values. This can be initialized by the defined matplotlib normalizations or a custom normalization.flipped (bool, optional) – If True, the azimuthal axis is flipped, following equatorial convention
fermi (bool, optional) – If True, plot in Fermi spacecraft coordinates, else plot in equatorial. Default is False.
**kwargs – Other plotting options
- Attributes
alpha_max (float) – The alpha opacity for the maximum color value
alpha_min (float) – The alpha opacity for the minimum color value
color (str) – The colormap
norm (
matplotlib.colors.Normalize
or similar) – The colormap normalizationvisible (bool) – True if the element is shown on the plot, False otherwise
- hide()¶
Hide the plot element
- remove()¶
Remove the plot element
- show()¶
Show the plot element
- toggle()¶
Toggle the visibility of the plot element
ModelData¶
- class gbm.plot.gbmplot.ModelData(x, y, xerr, yerr, ax, ulmask=None, color=None, alpha=None, **kwargs)[source]¶
Bases:
gbm.plot.gbmplot.GbmPlotElement
Plot a set of data with errors derived from the model variances.
- Parameters
x (np.array) – The x coordinates of the data plot points
y (np.array) – The y coordinates of the data plot points
xerr (np.array) – The uncertainty of the x points
yerr (np.array) – The uncertainty of the y points
ax (
matplotlib.axes
) – The axis on which to plotulmask (np.array(dtype=bool), optional) – A boolean array of the same size as x and y indicating which points are upper limits (True) and which are data points (False).
color (str, optional) – The color of the model
alpha (float, optional) – The alpha of the fill. Default is 1
**kwargs – Other plotting options
- Attributes
alpha (float) – The alpha opacity value, between 0 and 1.
color (str) – The color of the model.
visible (bool) – True if the element is shown on the plot, False otherwise
- hide()¶
Hide the plot element
- remove()¶
Remove the plot element
- show()¶
Show the plot element
- toggle()¶
Toggle the visibility of the plot element
ModelSamples¶
- class gbm.plot.gbmplot.ModelSamples(x, y_list, ax, color=None, alpha=None, label=None, **kwargs)[source]¶
Bases:
gbm.plot.gbmplot.GbmPlotElement
Plot a series of spectral model samples
- Parameters
x (np.array) – The x coordinates of the model
y_list (list of np.array) – A list of arrays, where each element is a single spectral sample, having length equal to x
ax (
matplotlib.axes
) – The axis on which to plotcolor (str, optional) – The color of the samples
alpha (float, optional) – The alpha of the fill. Default is 1
label (str, optional) – The label for the samples
**kwargs – Other plotting options
- Attributes
alpha (float) – The alpha opacity value, between 0 and 1.
color (str) – The color of the model.
visible (bool) – True if the element is shown on the plot, False otherwise
- hide()¶
Hide the plot element
- remove()¶
Remove the plot element
- show()¶
Show the plot element
- toggle()¶
Toggle the visibility of the plot element
Collection¶
- class gbm.plot.gbmplot.Collection[source]¶
Bases:
object
A container for a collection of like objects. The Collection class exposes the individual objects as attributes, and it exposes the methods of the object class so that methods can be called on the collection as a whole. For that reason, each object in the Collection must be of the same type, otherwise an error is raised. The type of the Collection is set by the first object inserted into the collection.
- Attributes
item_type (str) – The type of the items in the Collection
items (list) – The items in the Collection
size (int) – The number of items in the Collection
<item_name> (object) – If the item name can be converted to an attribute name, then each item name in the Collection becomes an attribute, returning the individual object
<item_attrib> (<attr>) – If the individual objects have public attributes, these will be made attributes of the Collection
<item_method> (<function>) – If the individual objects have public methods, these will be made methods of the Collection
- classmethod from_list(obj_list, names)[source]¶
Create a Collection of objects from a list and list of corresponding names
- Parameters
obj_list (list) – A list of objects of the same type
names (list of str) – A list of string names corresponding to the obj_list
- Returns
Collection
– The collection of objects