avni.plots.common module#
This module contains the various subroutines used for plotting
- avni.plots.common.updatefont(fontsize: int = 15, fontname: str = 'sans-serif', ax=None)[source]#
Updates the font type and sizes globally or for a particular axis handle
- Parameters
- fontsizeint, optional
Size of font, by default 15
- fontnamestr, optional
Name of font, by default ‘sans-serif’
- axmatplotlib.axes.Axes, optional
Axes handle, by default None
- Returns
- ax
Updated axes handle if ax is not None
- Authors
Raj Moulik (moulik@caa.columbia.edu)
- Last Modified
2023.02.16 5.00
- avni.plots.common.initializecolor(name: str, **kwargs)[source]#
Initialize a color palette instance.
This can be from standard Python palettes (e.g. jet), those in
constants()
or downloadable from server.- Parameters
- namestr
Name of color palette. Can have _r appended to standard ones for reversed color scales e.g. jet_r.
- **kwargsdict
Optional arguments for Basemap
- Returns
- cpalette
Output color palette
- Authors
Raj Moulik (moulik@caa.columbia.edu)
- Last Modified
2023.02.16 5.00
- avni.plots.common.standardcolorpalette(name: str = 'avni')[source]#
Register a custom AVNI color palette from
constants()
- Parameters
- namestr, optional
Color palette name that will be used elsewhere, by default ‘avni’. If name ends in ‘_r’, uses the reversed color scale
- Returns
- cpalette
Output color palette
- Authors
Raj Moulik (moulik@caa.columbia.edu)
- Last Modified
2023.02.16 5.00
- avni.plots.common.get_colors(val: float, xmin: float = - 1.0, xmax: float = 1.0, palette: str = 'coolwarm', colorcontour: int = 20) tuple [source]#
Gets the value of color for a given palette
- Parameters
- valfloat
Value to query
- xminfloat, optional
Minimum value or the color scale, by default -1.
- xmaxfloat, optional
Maximum value or the color scale, by default 1.
- palettestr, optional
Color palette to query, by default ‘coolwarm’
- colorcontourint, optional
Number of color contours to use in dividing up the color palette, by default 20
- Returns
- tuple
Tuple of (r, g, b, a) scalars.
- Authors
Raj Moulik (moulik@caa.columbia.edu)
- Last Modified
2023.02.16 5.00
- avni.plots.common.grayify_cmap(cmap)[source]#
Return a grayscale version of the colormap
- Parameters
- cmap
Input color palette
- Returns
- cpalette
Output color palette
- Authors
Raj Moulik (moulik@caa.columbia.edu)
- Last Modified
2023.02.16 5.00
- avni.plots.common.make_colormap(seq, name: str = 'CustomMap')[source]#
Return a LinearSegmentedColormap for a sequence of colors
- Parameters
- seq
A sequence of floats and RGB-tuples. The floats should be increasing and in the interval (0,1).
- namestr, optional
Name to give to this color palette, by default ‘CustomMap’
- Returns
- cpalette
Output color palette
- Authors
Raj Moulik (moulik@caa.columbia.edu)
- Last Modified
2023.02.16 5.00
- avni.plots.common.getcolorlist(cptfile: str, type='avni') list [source]#
Get a list of color tuples from a color palette (.cpt) file
- Parameters
- cptfilestr
A color palette file
- typestr, optional
Either avni format or standard per GMT project, by default ‘avni’
- Returns
- list
A list of colors tuples (r, g, b)
- Authors
Raj Moulik (moulik@caa.columbia.edu)
- Last Modified
2023.02.16 5.00
- avni.plots.common.readstandardcpt(cptfile: str) list [source]#
Read a GMT color map from a color palette (.cpt) file
- Parameters
- cptfilestr
color palette file
- Returns
- list
A list of colors tuples (r, g, b)
- Authors
Raj Moulik (moulik@caa.columbia.edu)
- Last Modified
2023.02.16 5.00
- avni.plots.common.customcolorpalette(name: str = 'bk', cptfolder: Union[None, str] = None, colormax: float = 2.0, middlelimit: float = 0.5, ifgraytest: int = 0)[source]#
Used to return preset color palettes from
constants.cptfolder()
- Parameters
- namestr, optional
Name of the color palette, by default ‘bk’
- cptfoldertp.Union[None, str], optional
Location of the color palette (.cpt) files, by default None so uses
constants.cptfolder()
- colormaxfloat, optional
Limits of the colorbar (-colormax,colormax), by default 2.
- middlelimitfloat, optional
Limit to which the middle color (e.g. grey) will extend on either side of color mid point, by default 0.5
- ifgraytestint, optional
Tests how the figure looks in gray scale, by default 0
- Returns
- cpalette
Output color palette
- Authors
Raj Moulik (moulik@caa.columbia.edu)
- Last Modified
2023.02.16 5.00