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, swedish and turkish.
- shadestr, optional
light or dark theme. Default is dark.
- 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 colormap for detailed options.
- shadestr, optional
Sets colormap shade for plots, see colormap for detailed options
Examples
>>> ci.set_style('paper') >>> ci.set_style('poster', shade='dark') >>> ci.set_style('presentation', palette='aussie')
Class Plotting Method¶
The following classes have plotting methods callable with the cls.plot() function, where cls is an instance of the appropriate class:
Calibration
Spectrum
DecayChain
Reaction
Stack
All cls.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.
f : matplotlib.pyplot figure
If figure and axes are supplied, then plot will be drawn on top of those axes.
ax : matplotlib.pyplot axes
If figure and axes are supplied, then plot will be drawn on top of those axes.
scale : str
Can specify the scale for the x and y axes with the following options:
log or logy : Set only y-scale to log
logx : Set only x-scale to log
lin, liny or linear : Set only y-scale to linear
linx : Set only x-scale to linear
linlin : x-scale and y-scale linear
loglog : x-scale and y-scale log
linlog : linear x-scale and log y-scale
loglin : log x-scale and linear y-scale
show : bool
Whether or not to show the figure using the matplotlib GUI.
saveas : str
Full filename for saving the figure in one of the matplotlib supported filetypes.
return_plot : bool
If True, then a tuple of (fig, axes) will be returned when calling the cls.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().