moniplot package
Subpackages
- moniplot.lib package
- Submodules
- moniplot.lib.fig_draw_image module
- moniplot.lib.fig_draw_lplot module
- moniplot.lib.fig_draw_multiplot module
- moniplot.lib.fig_draw_qhist module
- moniplot.lib.fig_draw_tracks module
- moniplot.lib.fig_draw_trend module
- moniplot.lib.fig_info module
- moniplot.lib.fig_legend module
- Module contents
Submodules
moniplot.biweight module
This module contains our Python of the Tukey’s biweight algorithm.
- class moniplot.biweight.Biweight(data: ndarray | Iterable, axis: int | None = None)[source]
Bases:
objectPython implementation of the Tukey’s biweight algorithm.
- Parameters:
data (array_like) – input array
axis (int, optional) – axis along which the biweight medians are computed.
Notes
Parameter data should not contain any invalid value.
Parameter axis will be ignored when data is a 1-D array.
- Raises:
TypeError – If axis is not an integer.
ValueError – If axis is invalid, e.g. axis > data.ndim.
Examples
Calculate biweight median, spread and unbiased estimator:
> from moniplot.biweight import Biweight > Biweight((1, 2, 2.5, 1.75, 2)).median 1.962936462507155 > Biweight((1, 2, 2.5, 1.75, 2)).spread 0.5042069490893494 > Biweight((1, 2, 2.5, 1.75, 2)).unbiased_std 0.6131156500926488
- property median: float | ndarray
Return biweight median.
- property spread: float | ndarray
Return biweight spread.
- property unbiased_std: float | ndarray
Return unbiased estimator.
- moniplot.biweight.biweight(data: ndarray | Iterable, axis: int | None = None, spread: bool = False) ndarray | tuple[numpy.ndarray, numpy.ndarray][source]
Python implementation of the Tukey’s biweight algorithm.
- Parameters:
data (array_like) – input array
axis (int, optional) – axis along which the biweight medians are computed. Note that axis will be ignored when data is a 1-D array.
spread (bool, optional) – if True, then return also the biweight spread.
- Returns:
out – biweight median and biweight spread if parameter “spread” is True
- Return type:
ndarray or tuple
moniplot.image_to_xarray module
This module contains the routines h5_to_xr and data_to_xr. These functions store a HDF5 dataset or numpy array in a labeled array (class xarray.DataArray).
- moniplot.image_to_xarray.data_to_xr(data: ndarray, *, dims: list[str] | None = None, name: str | None = None, long_name: str | None = None, units: str | None = None) DataArray[source]
Create xarray.DataArray from a dataset.
Implements a lite interface with the xarray.DataArray, should work for all 2-D detector images, sequences of detector measurements and trend data.
- Parameters:
data (np.ndarray) – Data to be stored in the xarray
dims (list of strings, optional) – Names for the dataset dimensions
name (str, optional) – A string that names the instance
units (str, optional) – Units of the data, default: ‘1’
long_name (str, optional) – Long name describing the data, default: empty string
- Return type:
xarray.DataArray
Notes
All floating datasets are converted to Python type ‘float’
- moniplot.image_to_xarray.h5_to_xr(h5_dset: Dataset, data_sel: tuple[slice | int] | None = None, *, dims: list[str] | None = None, field: str | None = None) DataArray[source]
Create xarray.DataArray from a HDF5 dataset (with dimension scales).
Implements a lite interface with the xarray.DataArray, should work for all 2-D detector images, sequences of detector measurements and trend data.
- Parameters:
h5_dset (h5py.Dataset) – Data, dimensions, coordinates and attributes are read for this dataset
data_sel (tuple of slice or int, optional) – A numpy slice generated for example numpy.s_
dims (list of strings, optional) – Alternative names for the dataset dimensions if not attached to dataset
field (str, optional) – Name of field in compound dataset or None
- Return type:
xarray.DataArray
Notes
All floating datasets are converted to Python type ‘float’
Dimensions and Coordinates:
The functions in this module should work with netCDF4 and HDF5 files.
In a HDF5 file the ‘coordinates’ of a dataset can be defined using dimension scales.
In a netCDF4 file this is required: all variables have dimensions, which can have coordinates. But under the hood also netCDF4 uses dimension scales.
The xarray DataArray structure will have as dimensions, the names of the dimension scales and as coordinates the names and data of the dimensions scales, except when the data only contains zero’s.
The default dimensions of an image are ‘row’ and ‘column’ with evenly spaced values created with np.arange(len(dim), dtype=uint).
Examples
Read HDF5 dataset ‘signal’ from file:
> fid = h5py.File(flname, 'r') # flname is a HDF5/netCDF4 file > xdata = h5_to_xr(fid['signal']) > fid.close()
Combine Tropomi SWIR data of band7 and band8:
> fid = h5py.File(s5p_b7_prod, 'r') # Tropomi band7 product > xdata7 = h5_to_xr(fid['signal']) > fid.close() > fid = h5py.File(s5p_b8_prod, 'r') # Tropomi band8 product > xdata8 = h5_to_xr(fid['signal']) > fid.close() > xdata = xr.concat((xdata7, xdata8), dim='spectral_channel')
Optionally, fix the ‘column’ dimension:
> xdata = xdata.assign_coords( > ... column = np.arange(xdata.column.size, dtype='u4'))
moniplot.mon_plot module
This module contains the class MONplot with the methods: draw_hist, draw_lplot, draw_multiplot, draw_qhist, draw_quality, draw_signal, draw_tracks, draw_trend, draw_fov_ckd.
- class moniplot.mon_plot.MONplot(figname: Path | str, caption: str | None = None)[source]
Bases:
objectGenerate PDF reports (or figures) to facilitate instrument calibration or monitoring.
- Parameters:
figname (Path | str) – Name of PDF or PNG file (extension required)
caption (str, optional) – Caption repeated on each page of the PDF
Notes
The methods of the class MONplot will accept numpy arrays as input and display your data without knowledge on the data units and coordinates. In most cases, this will be enough for a quick inspection of your data. However, when you use the labeled arrays and datasets of xarray`then the software will use the name of the xarray class, coordinate names and data attributes, such as `long_name and units.
- property caption: str
Returns caption of figure.
- property cmap
Returns current Matplotlib colormap.
- property cset: str
Returns name of current color-set.
- draw_fov_ckd(data: DataArray | ndarray, *, vp_blocks: tuple, vp_labels: tuple[str] | None = None, fig_info: FIGinfo | None = None, title: str | None = None, **kwargs) None[source]
Display a 2D CKD parameter which consists of data from several viewports.
- Parameters:
data (numpy.ndarray or xarray.DataArray) – Object holding measurement data and attributes.
vp_blocks (tuple) – Ranges of rows belonging to the data of one viewport. Each block is show in a separate subplot.
vp_labels (tuple of str) – Label for each viewport, default=(‘+50’, ‘+20’, ‘0’, ‘-20’, ‘-50’).
fig_info (FIGinfo, default=None) – OrderedDict holding meta-data to be displayed in the figure.
title (str, default=None) – Title of this figure using Axis.set_title.
**kwargs (other keywords) – Keyword arguments: zscale, vperc or vrange
Notes
The current implementation only works for SPEXone CKD: FIELD_OF_VIEW, POLARIMETRIC, RADIOMETRIC and WAVELENGTH
See also
fig_data_to_xarrPrepare image data for plotting.
Examples
Read SPEXone CKD:
> from pyspex.ckd_io import CKDio > with CKDio(ckd_file) as ckd: > fov_ckd = ckd.fov() > rad_ckd = ckd.radiometric()
Set row-ranges belonging to one viewport:
> nview = fov_ckd.dims['viewports'] > vp_blocks = () > for ii in range(nview): > ibgn = int(fov_ckd['fov_ifov_start_vp'][nview - ii - 1]) > iend = int(ibgn + fov_ckd['fov_nfov_vp'][nview - ii - 1] + 1) > vp_blocks += ([ibgn, iend],)
Create figures:
> from moniplot.mon_plot import MONplot > plot = MONplot('test_spx1_fov_ckd.pdf', caption='SPEXone CKD') > plot.draw_fov_ckd(rad_ckd.isel(polarization_directions=0), > vp_blocks=vp_blocks, > title=rad_ckd.attrs['long_name'] + ' (S+)') > plot.draw_fov_ckd(rad_ckd.isel(polarization_directions=1), > vp_blocks=vp_blocks, zscale='log', > title=rad_ckd.attrs['long_name'] + ' (S-)') > plot.close()
- draw_hist(data: DataArray | ndarray, data_sel: tuple[slice | int] | None = None, vrange: list[float, float] | None = None, fig_info: FIGinfo | None = None, title: str | None = None, **kwargs) None[source]
Display data as histograms.
- Parameters:
data (numpy.ndarray or xarray.DataArray) – Object holding measurement data and attributes.
data_sel (mask or index tuples for arrays, optional) – Select a region on the detector by fancy indexing (using a boolean/integer arrays), or using index tuples for arrays (generated with numpy.s_).
vrange (list[float, float], default=[data.min(), data.max()]) – The lower and upper range of the bins. Note data will also be clipped according to this range.
fig_info (FIGinfo, optional) – OrderedDict holding meta-data to be displayed in the figure.
title (str, optional) – Title of this figure using Axis.set_title. Default title is ‘f’Histogram of {data.attrs[“long_name”]}’.
**kwargs (other keywords) – Pass the following keyword arguments to matplotlib.pyplot.hist: ‘bins’, ‘density’ or ‘log’. Note that keywords: ‘histtype’, ‘color’, ‘linewidth’ and ‘fill’ are predefined.
See also
matplotlib.pyplot.histCompute and plot a histogram.
Notes
When data is a xarray.DataArray then the following attributes are used:
long_name: used as the title of the main panel when parameter ‘title’is not defined.
units: units of the data
Examples
Create a PDF document ‘test.pdf’ with two pages. Both pages have the caption “My Caption”, the title of the figure on the first page is “my title” and on the second page the title of the figure is f”Histogram of {xarr.attrs[‘long_name’]}”, if xarr has attribute “long_name”:
> plot = MONplot('test.pdf', caption='My Caption') > plot.set_institute('SRON') > plot.draw_hist(data, title='my title') > plot.draw_hist(xarr) > plot.close()
- draw_lplot(xdata: ndarray | None = None, ydata: ndarray | None = None, *, square: bool = False, fig_info: FIGinfo | None = None, title: str | None = None, kwlegend: dict | None = None, **kwargs) None[source]
Plot y versus x lines, maybe called multiple times to add lines. Figure is closed when called with xdata equals None.
- Parameters:
xdata (ndarray, optional) –
[add line]X-data.ydata (ndarray, optional) –
[add line]Y-data, or[close figure]when ydata is None.square (bool, default=False) –
[add line]create a square figure, independent of number of data-points (first call, only).fig_info (FIGinfo, optional) –
[close figure]Meta-data to be displayed in the figure.title (str, optional) –
[close figure]Title of figure (using Axis.set_title).kwlegend (dict, optional) –
[close figure]Provide keywords for the function Axes.legend. Default: {‘fontsize’: ‘small’, ‘loc’: ‘best’}**kwargs (other keywords) –
[add line]Keywords are passed to matplotlib.pyplot.plot;[close figure]Keywords are passed to appropriate matplotlib.Axes method, and the keyword ‘text’ can be used to add addition text in the upper left corner.
Examples
General example:
> plot = MONplot(fig_name) > for ii, xarr, yarr in enumerate(data_of_each_line):
… plot.draw_lplot(xarr, yarr, label=mylabel[ii], marker=’o’)
> plot.draw_lplot(xlim=[0, 0.5], ylim=[-10, 10], … xlabel=’x-axis, ylabel=y-axis’) > plot.close()
Using a time-axis:
> from datetime import datetime, timedelta > tt0 = (datetime(year=2020, month=10, day=1)
… + timedelta(seconds=sec_in_day)) > tt = [tt0 + iy * t_step for iy in range(yy.size)] > plot = MONplot(fig_name) > plot.draw_lplot(tt, yy, label=’mylabel’, marker=’o’) > plot.draw_lplot(ylim=[-10, 10], xlabel=’t-axis’, ylabel=’y-axis’) > plot.close()
You can use different sets of colors and cycle through them. First, we use default colors defined by matplotlib:
> plot = MONplot('test_lplot.pdf') > plot.set_cset(None) > for ii in range(5):
… plot.draw_lplot(np.arange(10), np.arange(10)*(ii+1)) > plot.draw_lplot(xlabel=’x-axis’, ylabel=’y-axis’, … title=’draw_lplot [cset is None]’)
You can also assign colors to each line:
> for ii, clr in enumerate('rgbym'):
… plot.draw_lplot(np.arange(10), np.arange(10)*(ii+1), color=clr) > plot.draw_lplot(xlabel=’x-axis’, ylabel=’y-axis’, … title=’draw_lplot [cset=”rgbym”]’)
You can use one of the color sets as defined in
tol_colors:> plot.set_cset('mute') # Note the default is 'bright' > for ii in range(5):
… plot.draw_lplot(ydata=np.arange(10)*(ii+1)) > plot.draw_lplot(xlabel=’x-axis’, ylabel=’y-axis’, … title=’draw_lplot [cset=”mute”]’)
Or you can use a color map as defined in
tol_colorswhere you can define the number of colors you need. If you need less than 24 colors, you can use ‘rainbow_discrete’ or you can choose one color map if you need more colors, for example:> plot.set_cset('rainbow_PuBr', 25) > for ii in range(25):
… plot.draw_lplot(ydata=np.arange(10)*(ii+1)) > plot.draw_lplot(xlabel=’x-axis’, ylabel=’y-axis’, … title=’draw_lplot [cset=”rainbow_PyBr”]’) > plot.close()
- draw_multiplot(data_tuple: tuple, gridspec=None, *, fig_info: FIGinfo | None = None, title: str | None = None, **kwargs) None[source]
Display multiple subplots on one page using matplotlib.gridspec.GridSpec.
- Parameters:
data_tuple (tuple of np.ndarray, xarray.DataArray or xarray.Dataset) – One dataset per subplot.
gridspec (matplotlib.gridspec.GridSpec, optional) – Instance of matplotlib.gridspec.GridSpec.
fig_info (FIGinfo, optional) – Meta-data to be displayed in the figure.
title (str, optional) – Title of this figure using Axis.set_title. Ignored when data is a xarray data-structure.
**kwargs (other keywords) – The keywords are passed to matplotlib.pyplot.plot. Ignored when data is a xarray data-structure.
See also
matplotlib.pyplot.plotPlot y versus x as lines and/or markers.
Notes
When data is a xarray.DataArray then the following attributes are used:
long_name: used as the title of the main panel when parameter ‘title’ is not defined.
units: units of the data
_plot: dictionary with parameters for matplotlib.pyplot.plot
_title: title of the subplot (matplotlib: Axis.set_title)
_text: text shown in textbox placed in the upper left corner
_yscale: y-axis scale type, default ‘linear’
_xlim: range of the x-axis
_ylim: range of the y-axis
Examples
Show two numpy arrays, each in a different panel. The subplots are above each other (row=2, col=1). The X-coordinates are generated using np.range(ndarray1) and np.range(ndarray2):
> data_tuple = (ndarray1, ndarray2) > plot = MONplot(fig_name) > plot.draw_multiplot(data_tuple, title='my title',
… marker=’o’, linestyle=’’, color=’r’) > plot.close()
Show four DataArrays, each in a different panel. The subplots are above each other in 2 columns (row=2, col=2). The X-coordinates are generated from the first dimension of the DataArrays:
> data_tuple = (xarr1, xarr2, xarr3, xarr4) > plot = MONplot(fig_name) > plot.draw_multiplot(data_tuple, title='my title',
… marker=’o’, linestyle=’’) > plot.close()
Show the DataArrays in a Dataset, each in a different panel. If there are 3 DataArrays preset then the subplots are above each other (row=3, col=1). The X-coordinates are generated from the (shared?) first dimension of the DataArrays:
> plot = MONplot(fig_name) > plot.draw_multiplot(xds, title='my title') > plot.close()
- draw_qhist(xds: DataArray, data_sel: tuple[slice, int] | None = None, density: bool = True, fig_info: FIGinfo | None = None, title: str | None = None) None[source]
Display pixel-quality data as histograms.
- Parameters:
xds (xarray.Dataset) – Object holding measurement data and attributes.
data_sel (mask or index tuples for arrays, optional) – Select a region on the detector by fancy indexing (using a boolean/interger arrays), or using index tuples for arrays (generated with numpy.s_).
density (bool, default=True) – If True, draw and return a probability density: each bin will display the bin’s raw count divided by the total number of counts and the bin width (see matplotlib.pyplot.hist).
fig_info (FIGinfo, optional) – OrderedDict holding meta-data to be displayed in the figure.
title (str, optional) – Title of this figure using Axis.set_title.
See also
matplotlib.pyplot.histCompute and plot a histogram.
Notes
When data is a xarray.DataArray then the following attributes are used:
long_name: used as the title of the main panel when parameter ‘title’is not defined.
units: units of the data
Examples
Create a PDF document ‘test.pdf’ and add figure of dataset ‘xds’ (numpy.ndarray or xarray.DataArray) with a title. The dataset ‘xds’ may contain multiple DataArrays with a common X-coordinate. Each DataArray will be displayed in a seperate sub-panel.
>>> plot = MONplot('test.pdf', caption='my caption', institute='SRON') >>> plot.draw_qhist(xds, title='my title') >>> plot.close()
- draw_quality(data: DataArray | ndarray, ref_data: ndarray | None = None, *, side_panels: str = 'quality', fig_info: FIGinfo | None = None, title: str | None = None, **kwargs) None[source]
Display pixel-quality 2D array as image with column/row statistics.
- Parameters:
data (numpy.ndarray or xarray.DataArray) – Object holding measurement data and attributes.
ref_data (numpy.ndarray, default=None) – Numpy array holding reference data, for example pixel quality reference map taken from the CKD. Shown are the changes with respect to the reference data.
fig_info (FIGinfo, default=None) – OrderedDict holding meta-data to be displayed in the figure.
side_panels (str, default='quality') – Show image row and column statistics in two side panels. Use ‘none’ when you do not want the side panels.
title (str, default=None) – Title of this figure using Axis.set_title.
**kwargs (other keywords) – Pass keyword arguments: data_sel, thres_worst, thres_bad or qlabels to moniplot.lib.fig_draw_image.fig_qdata_to_xarr.
See also
qdata_to_xarrPrepare pixel-quality data for plotting.
Notes
When data is a xarray.DataArray then the following attributes are used:
'long_name' : used as the title of the main panel when parameter `title` is not defined. 'flag_values' : values of the flags used to qualify the pixel quality 'flag_meanings' : description of the flag values 'thres_bad' : threshold between good and bad 'thres_worst' : threshold between bad and worst '_cmap' : contains the matplotlib colormap '_zscale' : should be 'quality' '_znorm' : matplotlib class to normalize the data between zero and one
The quality ranking labels are [‘unusable’, ‘worst’, ‘bad’, ‘good’], when no reference dataset is provided. Where:
'unusable' : pixels outside the illuminated region 'worst' : 0 <= value < thres_worst 'bad' : 0 <= value < thres_bad 'good' : thres_bad <= value <= 1
Otherwise, the labels for quality ranking indicate which pixels have changed w.r.t. reference. The labels are:
'unusable' : pixels outside the illuminated region 'worst' : from good or bad to worst 'bad' : from good to bad 'good' : from any rank to good 'unchanged' : no change in rank
The information provided in the parameter fig_info will be displayed in a small box. Where creation date and statistics on the number of bad and worst pixels are displayed.
Examples
Create a PDF document ‘test.pdf’ and add figure of dataset img (numpy.ndarray or xarray.DataArray) with side-panels and title:
> plot = MONplot('test.pdf', caption='my caption', institute='SRON') > plot.draw_quality(img, title='my title')
Add the same figure without side-panels:
> plot.draw_quality(img, side_panels='none', title='my title')
Add a figure where img_ref is a quality map from early in the mission:
> plot.draw_quality(img, img_ref, title='my title')
Finalize the PDF file:
> plot.close()
- draw_signal(data: DataArray | ndarray, *, fig_info: FIGinfo | None = None, side_panels: str = 'nanmedian', title: str | None = None, **kwargs) None[source]
Display 2D array as an image and averaged column/row signal in the side-panels (optional).
- Parameters:
data (numpy.ndarray or xarray.DataArray) – Object holding measurement data and attributes.
fig_info (FIGinfo, default=None) – OrderedDict holding meta-data to be displayed in the figure.
side_panels (str, default='nanmedian') – Show image row and column statistics in two side panels. Use ‘none’ when you do not want the side panels. Other valid values are: ‘median’, ‘nanmedian’, ‘mean’, ‘nanmean’, ‘quality’, ‘std’ and ‘nanstd’.
title (str, default=None) – Title of this figure using Axis.set_title.
**kwargs (other keywords) – Pass keyword arguments: zscale, vperc or vrange to moniplot.lib.fig_draw_image.fig_data_to_xarr().
See also
fig_data_to_xarrPrepare image data for plotting.
Notes
When data is a xarray.DataArray then the following attributes are used:
'long_name' : used as the title of the main panel when parameter `title` is not defined. '_cmap' : contains the matplotlib colormap '_zlabel' : contains the label of the color bar '_znorm' : matplotlib class to normalize the data between zero and one. '_zscale' : scaling of the data values: linear, log, diff, ratio, ... '_zunits' : adjusted units of the data
The information provided in the parameter fig_info will be displayed in a text box. In addition, we display the creation date and the data (biweight) median & spread.
Currently, we have turned off the automatic offset notation of matplotlib. Maybe this should be the default, which the user may override.
Examples
Create a PDF document ‘test.pdf’ and add figure of dataset img (numpy.ndarray or xarray.DataArray) with side-panels and title:
> plot = MONplot('test.pdf', caption='my caption') > plot.set_institute('SRON') > plot.draw_signal(img, title='my title')
Add the same figure without side-panels:
> plot.draw_signal(img, side_panels='none', title='my title')
Add a figure using a fixed data-range that the colormap covers:
> plot.draw_signal(img1, title='my title', vrange=[zmin, zmax])
Add a figure where img2 = img - img_ref:
> plot.draw_signal(img2, title='my title', zscale='diff')
Add a figure where img2 = img / img_ref:
> plot.draw_signal(img2, title='my title', zscale='ratio')
Finalize the PDF file:
> plot.close()
- draw_tracks(lons: ndarray, lats: ndarray, icids: ndarray, *, saa_region: ndarray | None = None, fig_info: FIGinfo | None = None, title: str | None = None) None[source]
Display tracks of satellite on a world map using a Robinson projection.
- Parameters:
lons ((N, 2) array-like) – Longitude coordinates at start and end of measurement
lats ((N, 2) array-like) – Latitude coordinates at start and end of measurement
icids – ICID of measurements per (lon, lat)
saa_region ((N, 2) array-like, optional) – The coordinates of the vertices. When defined, then show SAA region as a matplotlib polygon patch
fig_info (FIGinfo, optional) – OrderedDict holding meta-data to be displayed in the figure
title (str, optional) – Title of this figure using Axis.set_title
displayed (The information provided in the parameter 'fig_info' will be) –
box. (in a small) –
- draw_trend(xds: DataArray | None = None, hk_xds: DataArray | None = None, *, fig_info: FIGinfo | None = None, title: str | None = None, **kwargs) None[source]
Display trends of measurement data and/or housekeeping data
- Parameters:
xds (xarray.Dataset, optional) – Object holding measurement data and attributes.
hk_xds (xarray.Dataset, optional) – Object holding housekeeping data and attributes.
fig_info (FIGinfo, optional) – OrderedDict holding meta-data to be displayed in the figure.
title (str, optional) – Title of this figure using Axis.set_title.
**kwargs (other keywords) – Pass keyword arguments: ‘vperc’ or ‘vrange_last_orbits’ to ‘moniplot.lib.fig_draw_trend.add_hk_subplot`.
See also
add_hk_subplotAdd a subplot for housekeeping data.
Notes
When data is a xarray.DataArray then the following attributes are used:
long_name: used as the title of the main panel when parameter ‘title’ is not defined.
units: units of the data
Examples
Create a PDF document ‘test.pdf’ and add figure of dataset ‘xds’ (numpy.ndarray or xarray.DataArray) with a title. The dataset ‘xds’ may contain multiple DataArrays with a common X-coordinate. Each DataArray will be displayed in a separate sub-panel:
> plot = MONplot('test.pdf', caption='my caption', institute='SRON') > plot.draw_trend(xds, hk_xds=None, title='my title')
Add a figure with the same Dataset ‘xds’ and a few trends of housekeeping data (again each parameter in a separate DataArray with a common X-coordinate):
> plot.draw_trend(xds, hk_xds, title='my title')
Finalize the PDF file:
> plot.close()
- property institute: str
Returns name of institute.
- set_caption(caption: str) None[source]
Set caption of each page of the PDF.
- Parameters:
caption (str) – Default title of all pages at the top of the page.
- set_cmap(cmap) None[source]
Use alternative colormap for MONplot::draw_image.
- Parameters:
cmap (matplotlib colormap) –
- set_cset(cname: str, cnum: int | None = None) None[source]
Use alternative color-set through which draw_lplot will cycle.
- Parameters:
cname (str) – Name of color set. Use None to get the default matplotlib value.
cnum (int, optional) – Number of discrete colors in colormap (not colorset).
moniplot.tol_colors module
This module contains the definitions of color schemes and color set provided by Paul Tol.
Routines in this module:
tol_cmap(colormap=None, lut=0)
tol_cset(colorset=None)
tol_rgba(cname, cnum=None)
- moniplot.tol_colors.tol_cmap(colormap: str | None = None, lut: int = 0)[source]
Continuous and discrete color sets for ordered data.
Definition of colour schemes for lines which also work for colour-blind people. See https://personal.sron.nl/~pault/ for background information and best usage of the schemes.
- Parameters:
colormap (str, optional) – Return predefined colormap with given name. If not given, all possible values for colormap.
lut (int, default=0) – Number of discrete colors in colormap. Parameter lut is ignored for all colormaps except ‘rainbow_discrete’.
- Return type:
matplotlib.colormaps
Examples
Typical usage:
> cmap = tol_cmap('nightfall')
- moniplot.tol_colors.tol_cset(colorset: str | None = None) dataclass[source]
Discrete color sets for qualitative data.
Definition of colour schemes for lines which also work for colour-blind people. See https://personal.sron.nl/~pault/ for background information and best usage of the schemes.
- Parameters:
colorset (str) – if None then the names of all color-sets are returned.
- Returns:
a dataclass instance with colors as hexadecimal values.
- Return type:
dataclass
Examples
Typical usage:
> cset = tol_cset('bright')
moniplot.unbiased_std module
Module contents
Moniplot is a Python data visualization library for (satellite) instrument monitoring.