Plotting
- curie.colormap(palette=None, shade=None, aslist=False)[source]
Broad spectrum of hex-formatted colors for plotting
Function to provide a broad palette of colors for plotting, inspired by the FlatUI color picker at https://flatuicolors.com/
- Parameters:
- palettestr, optional
Choice of color palette. Options are
default,american,aussie,british,canadian,chinese,french,german,indian,russian,spanish,swedishandturkish.- shadestr, optional
lightordarktheme. Default isdark.- aslistbool, optional
Specifies whether to return the colormap as a dictionary, e.g. {‘k’:’#000000’, ‘w’:’#ffffff’} or as a list, e.g. [‘#000000’, ‘#ffffff’]. Default is
False(returns dictionary)
- Returns:
- colormapdict or list
Colormap in list or dictionary format
Examples
>>> cm = ci.colormap() >>> print(cm) {'b': '#2980b9', 'g': '#27ae60', 'k': '#2c3e50', 'o': '#d35400', 'aq': '#16a085', 'p': '#8e44ad', 'r': '#c0392b', 'gy': '#7f8c8d', 'w': '#bdc3c7', 'y': '#f39c12'} >>> cm_list = ci.colormap(aslist=True) >>> cm_british_light = ci.colormap('british', 'light')
- curie.set_style(style='default', palette='default', shade='dark')[source]
Preset styles for generating plots
Adjusts default font sizes, colors and spacing for plots, with presets based on the intended application (i.e.
poster,paper, etc.)- Parameters:
- stylestr, optional
Preset style based on intended application of the plot. Options are
paper,poster,presentation, and the default:default.- palettestr, optional
Sets colormap palette for plots, see
colormapfor detailed options.- shadestr, optional
Sets colormap shade for plots, see
colormapfor detailed options
Examples
>>> ci.set_style('paper') >>> ci.set_style('poster', shade='dark') >>> ci.set_style('presentation', palette='aussie')
Class Plotting Methods
The following classes have plotting methods callable as obj.plot(), where obj is an instance of the appropriate class:
Calibration
Spectrum
DecayChain
Reaction
Stack
All obj.plot() methods have no required arguments, and while some have specific optional arguments that are documented in the respective classes,
all plotting methods share the same optional keyword arguments, denoted in the code by **kwargs.
- fmatplotlib.pyplot figure
The figure to draw on. Supply
fandaxtogether to draw on top of existing axes (e.g. to overlay several plots).- axmatplotlib.pyplot axes
The axes to draw on. Supply
fandaxtogether to draw on top of existing axes.- figsizetuple
Width and height of the figure in inches, passed to
matplotlib.pyplot.subplots, e.g.(8, 5).- scalestr
Can specify the scale for the x and y axes with the following options:
logorlogy: Set only y-scale to loglogx: Set only x-scale to loglin,linyorlinear: Set only y-scale to linearlinx: Set only x-scale to linearlinlin: x-scale and y-scale linearloglog: x-scale and y-scale loglinlog: linear x-scale and log y-scaleloglin: log x-scale and linear y-scale
- showbool
Whether or not to show the figure using the matplotlib GUI.
- saveasstr
Full filename for saving the figure. Any matplotlib-supported image format is accepted; a
.picklefilename instead saves the figure object itself to disk, so it can be reloaded and edited later in Python.- return_plotbool
If
True, then a tuple of (fig, axes) will be returned when calling theobj.plot()method. This can be used to draw multiple plots over each other, e.g. for plotting multiple cross-sections.
style, palette and shade are also available as keyword arguments, and have the same behavior as in curie.set_style().