cape.tnakit.plot_mpl
: Matplotlib/Pyplot Interfaces¶
This module contains handles to various matplotlib
plotting
methods. In particular, it centralizes some of the multiple-line
instructions that are used in multiple places. An example is placing
labels on one or more corners of the axis window.
It also includes syntax to import modules without raising ImportError
.
- class cape.tnakit.plot_mpl.MPLHandle(**kw)¶
Container for handles from
matplotlib.pyplot
- Versions:
2019-12-20
@ddalle
: First version
- add(h1)¶
Combine two plot handle objects
Attributes of h1 will override those of h except where the attribute is a list. For example, h1.lines will be added to h.lines to get handles to lines from both instances.
- close()¶
Close the open figure, if any
- Call:
>>> h.close()
- Inputs:
- h:
MPLHandle
Matplotlib object handle
- h:
- Versions:
2022-05-17
@ddalle
: Version 1.0
- save(attr, v)¶
Save one plot object without erasing others
This method provides a simple method to save multiple instances of a certain kind of plot object without having to perform checks manually. For example if h.lines already contains several lines, and L contains several new ones, then
h.save("lines", L)
will effectively runh.lines += L
.Conversions from single object to
list
are handled automatically, and items are only added to the list if not already present. Thus runningsave()
several times in a row with the same arguments will not create the illusion of many objects for a given attribute.- Call:
>>> h.save(attr, v)
- Inputs:
- h:
MPLHandle
Matplotlib object handle
- attr:
str
Name of attribute to save
- v:
any
Value to save/add for that attribute
- h:
- Versions:
2020-01-25
@ddalle
: First version
- class cape.tnakit.plot_mpl.MPLOpts(_optsdict=None, _warnmode=1, **kw)¶
Options class for all plot methods in
plot_mpl
module- Call:
>>> opts = MPLOpts(**kw)
- Inputs:
- kw:
dict
Keyword options to be filtered and mapped
- kw:
- Outputs:
- opts:
plot_mpl.MPLOpts
Options from kwargs with defaults applied
- opts:
- Versions:
2020-01-23
@ddalle
: Version 2.0 based on KwargHandler
- axadjust_col_options()¶
Process options for axes margin adjustment
- Call:
>>> kw = opts.axadjust_col_options()
- Inputs:
- opts:
MPLOpts
Options interface
- opts:
- Keys:
- MarginBottom: {
None
} |float
Figure fraction from bottom edge to bottom label
- MarginLeft: {
None
} |float
Figure fraction from left edge to left-most label
- MarginRight: {
None
} |float
Figure fraction from right edge to right-most label
- MarginTop: {
None
} |float
Figure fraction from top edge to top-most label
- MarginVSpace, vspace: {
None
} |float
Figure fraction for vertical space between axes
- AdjustBottom: {
None
} |float
Figure-scale coordinates of bottom of axes
- AdjustLeft: {
None
} |float
Figure-scale coordinates of left side of axes
- AdjustRight: {
None
} |float
Figure-scale coordinates of right side of axes
- AdjustTop: {
None
} |float
Figure-scale coordinates of top of axes
- SubplotList: {
None
} |list
[int
] List of subplots to put in row/column
- SubplotRubber: {
None
} |int
Index of subplot to expand
- MarginBottom: {
- Outputs:
- kw:
dict
Dictionary of options to
axes_adjust_col()
- kw:
- Versions:
2020-01-10
@ddalle
: First version2020-01-18
@ddalle
: UsingKwargHandler
- axadjust_options()¶
Process options for axes margin adjustment
- Call:
>>> kw = opts.axadjust_options()
- Inputs:
- opts:
MPLOpts
Options interface
- opts:
- Keys:
- MarginBottom: {
None
} |float
Figure fraction from bottom edge to bottom label
- MarginLeft: {
None
} |float
Figure fraction from left edge to left-most label
- MarginRight: {
None
} |float
Figure fraction from right edge to right-most label
- MarginTop: {
None
} |float
Figure fraction from top edge to top-most label
- AdjustBottom: {
None
} |float
Figure-scale coordinates of bottom of axes
- AdjustLeft: {
None
} |float
Figure-scale coordinates of left side of axes
- AdjustRight: {
None
} |float
Figure-scale coordinates of right side of axes
- AdjustTop: {
None
} |float
Figure-scale coordinates of top of axes
- KeepAspect: {
None
} |True
|False
Keep aspect ratio; default is
True
unless``ax.get_aspect()`` is"auto"
- Subplot, subplot: {
None
} |Axes
|int
Subplot index (1-based)
- SubplotCols: {
None
} |int
> 0 Expected number of subplot columns
- SubplotRows: {
None
} |int
> 0 Expected number of subplot rows
- MarginBottom: {
- Outputs:
“CoverageCDF”: CoverageOptions.Coverage, * 2020-01-08
@ddalle
: First version * 2020-01-18@ddalle
: UsingKwargHandler
- axadjust_row_options()¶
Process options for axes margin adjustment
- Call:
>>> kw = opts.axadjust_row_options()
- Inputs:
- opts:
MPLOpts
Options interface
- opts:
- Keys:
- MarginBottom: {
None
} |float
Figure fraction from bottom edge to bottom label
- MarginLeft: {
None
} |float
Figure fraction from left edge to left-most label
- MarginRight: {
None
} |float
Figure fraction from right edge to right-most label
- MarginTop: {
None
} |float
Figure fraction from top edge to top-most label
- MarginHSpace, hspace: {
None
} |float
Figure fraction for horizontal space between axes
- AdjustBottom: {
None
} |float
Figure-scale coordinates of bottom of axes
- AdjustLeft: {
None
} |float
Figure-scale coordinates of left side of axes
- AdjustRight: {
None
} |float
Figure-scale coordinates of right side of axes
- AdjustTop: {
None
} |float
Figure-scale coordinates of top of axes
- SubplotList: {
None
} |list
[int
] List of subplots to put in row/column
- SubplotRubber: {
None
} |int
Index of subplot to expand
- MarginBottom: {
- Outputs:
- kw:
dict
Dictionary of options to
axes_adjust_row()
- kw:
- Versions:
2020-01-10
@ddalle
: First version2020-01-18
@ddalle
: UsingKwargHandler
- axes_options()¶
Process options for axes handle
- Call:
>>> kw = opts.axes_options()
- Inputs:
- opts:
MPLOpts
Options interface
- opts:
- Keys:
- ax, Axes: {
None
} |matplotlib.axes._subplots.Axes
Handle to existing axes
- AxesOptions: {
None
} |dict
Options to
AxesSubplot
- ax, Axes: {
- Outputs:
- kw:
dict
Dictionary of options to
plt.axes()
- kw:
- Versions:
2019-03-07
@ddalle
: First version2019-12-20
@ddalle
: Fromtnakit.mpl.mplopts
2020-01-17
@ddalle
: UsingKwargHandler
- axformat_options()¶
Process options for axes format
- Call:
>>> kw = opts.axformat_options()
- Inputs:
- opts:
MPLOpts
Options interface
- opts:
- Keys:
- Density, density: {
True
} |False
Option to scale histogram plots
- Index, i: {
0
} |int
>=0 Index to select specific option from lists
- Pad: {
None
} |float
Padding to add to both axes, ax.set_xlim and ax.set_ylim
- Rotate, rotate: {
True
} |False
Option to flip x and y axes
- XLabel, xlabel: {
None
} |str
Label to put on x axis
- XLim, xlim: {
None
} | (float
,float
) Limits for min and max value of x-axis
- XLimMax: {
None
} |float
Min value for x-axis in plot
- XLimMin: {
None
} |float
Max value for x-axis in plot
- XPad: {Pad} |
float
Extra padding to add to x axis limits
- YLabel, ylabel: {
None
} |str
Label to put on y axis
- YLim, ylim: {
None
} | (float
,float
) Limits for min and max value of y-axis
- YLimMax: {
None
} |float
Min value for y-axis in plot
- YLimMin: {
None
} |float
Max value for y-axis in plot
- YPad: {Pad} |
float
Extra padding to add to y axis limits
- Density, density: {
- Outputs:
- kw:
dict
Dictionary of options to
axes_format()
- kw:
- Versions:
2019-03-07
@jmeeroff
: First version2020-01-18
@ddalle
: UsingKwargHandler
- contour_options()¶
Process options for contour plots
- Call:
>>> kw = opts.contour_options()
- Inputs:
- opts:
MPLOpts
Options interface
- opts:
- Keys:
- Index, i: {
0
} |int
>=0 Index to select specific option from lists
- Rotate, rotate: {
True
} |False
Option to flip x and y axes
- ContourType: {
tricontourf
} |tricontour
|tripcolor
Contour type specifier
- ContourLevels: {
None
} |int
|np.ndarray
Number or list of levels for contour plots
- ContourOptions: {
None
} |dict
Options to
plt.tricontour()
and variants- MarkPoints: {
True
} |False
Put a marker at contributing data points
- MarkerColor: {
None
} |str
|tuple
Color for markers in MarkerOptions
- MarkerOptions: {
None
} |dict
Options for markers on non-plot() functions
- MarkerSize: {
None
} |int
|float
markersize passed to MarkerOptions
- Label, label, lbl: {
None
} |str
Label passed to
plt.legend()
- ContourColorMap: {
None
} |str
Color map for contour plots
- Index, i: {
- Outputs:
- kw:
dict
Dictionary of options to
contour()
- kw:
- Versions:
2020-03-26
@jmeeroff
: First version
- coverage_options()¶
Process options for coverage intervals
- Call:
>>> kw = opts.coverage_options()
- Inputs:
- opts:
MPLOpts
Options interface
- opts:
- Keys:
%(keys)s
- Outputs:
- kw:
dict
Dictionary of options for coverage intervals
- kw:
- Versions:
2019-03-05
@ddalle
: First version2019-12-21
@ddalle
: Fromtnakit.mpl.mplopts
2020-01-17
@ddalle
: UsingKwargHandler
- delta_options()¶
Process options for delta plots
- Call:
>>> kw = opts.delta_options()
- Inputs:
- opts:
MPLOpts
Options interface
- opts:
- Keys:
%(keys)s
- Outputs:
- kw:
dict
Dictionary of options for mpl._plot
- kw:
- Versions:
2019-03-05
@ddalle
: First version2019-12-21
@ddalle
: Fromtnakit.mpl.mplopts
2020-01-17
@ddalle
: UsingKwargHandler
- deltalabel_options()¶
Process options for delta labels
- Call:
>>> kw = opts.deltalabel_options()
- Inputs:
- opts:
MPLOpts
Options interface
- opts:
- Keys:
%(keys)s
- Outputs:
- kw:
dict
Dictionary of options for mpl.axlabel
- kw:
- Versions:
2019-03-05
@ddalle
: First version2019-12-21
@ddalle
: Fromtnakit.mpl.mplopts
2020-01-17
@ddalle
: UsingKwargHandler
- error_options()¶
Process options for error plots
- Call:
>>> kw = opts.error_options()
- Inputs:
- opts:
MPLOpts
Options interface
- opts:
- Keys:
- Index, i: {
0
} |int
>=0 Index to select specific option from lists
- Rotate, rotate: {
True
} |False
Option to flip x and y axes
- ErrorOptions: {
None
} |dict
Options for error plots
- ErrorPlotType:
"FillBetween"
| {"ErrorBar"
} Plot type for “error” plots
- ErrorBarOptions, ErrorBarOpts: {
None
} |dict
Options for
errorbar()
plots- ErrorBarMarker: {
None
} |str
Marker for
errorbar()
plots- FillBetweenOptions, FillBetweenOpts: {
None
} |dict
Options for
fill_between()
plots- PlotOptions, PlotOpts: {
None
} |dict
Options to
plt.plot()
for primary curve
- Index, i: {
- Outputs:
- kw:
dict
Dictionary of options to
error()
- kw:
- Versions:
2019-03-04
@ddalle
: First version2019-12-23
@ddalle
: Fromtnakit.mpl.mplopts
2020-01-17
@ddalle
: UsingKwargHandler
- errorbar_options()¶
Process options for
errorbar()
calls- Call:
>>> kw = opts.errorbar_options()
- Inputs:
- opts:
MPLOpts
Options interface
- opts:
- Keys:
- ErrorBarOptions, ErrorBarOpts: {
None
} |dict
Options for
errorbar()
plots- Index, i: {
0
} |int
>=0 Index to select specific option from lists
- Rotate, rotate: {
True
} |False
Option to flip x and y axes
- ErrorBarMarker: {
None
} |str
Marker for
errorbar()
plots- PlotOptions, PlotOpts: {
None
} |dict
Options to
plt.plot()
for primary curve
- ErrorBarOptions, ErrorBarOpts: {
- Outputs:
- kw:
dict
Dictionary of options to
errorbar()
- kw:
- Versions:
2019-03-05
@ddalle
: First version2019-12-21
@ddalle
: Fromtnakit.mpl.mplopts
2020-01-17
@ddalle
: UsingKwargHandler
- figure_options()¶
Process options specific to Matplotlib figure
- Call:
>>> kw = figure_options()
- Inputs:
- opts:
MPLOpts
Options interface
- opts:
- Keys:
- fig, Figure: {
None
} |matplotlib.figure.Figure
Handle to existing figure
- FigOptions: {
None
} |dict
Options to
matplotlib.figure.Figure
- FigNumber, nfig, numfig: {
None
} |int
> 0 Figure number
- FigWidth, wfig: {
None
} |float
> 0.0 Figure width [inches]
- FigHeight, hfig: {
None
} |float
> 0.0 Figure height [inches]
- FigDPI: {
None
} |int
> 0 |float
> 0.0 Figure resolution in dots per inch
- fig, Figure: {
- Outputs:
- kw:
dict
Dictionary of options to
plt.figure()
- kw:
- Versions:
2019-03-06
@ddalle
: First version2019-12-20
@ddalle
: Fromtnakit.mpl.mplopts
2020-01-17
@ddalle
: UsingKwargHandler
- fillbetween_options()¶
Process options for
fill_between()
calls- Call:
>>> kw = opts.fillbetween_options()
- Inputs:
- opts:
MPLOpts
Options interface
- opts:
- Keys:
- FillBetweenOptions, FillBetweenOpts: {
None
} |dict
Options for
fill_between()
plots- Index, i: {
0
} |int
>=0 Index to select specific option from lists
- Rotate, rotate: {
True
} |False
Option to flip x and y axes
- PlotOptions, PlotOpts: {
None
} |dict
Options to
plt.plot()
for primary curve
- FillBetweenOptions, FillBetweenOpts: {
- Outputs:
- kw:
dict
Dictionary of options to
fill_between()
- kw:
- Versions:
2019-03-05
@ddalle
: First version2019-12-21
@ddalle
: Fromtnakit.mpl.mplopts
2020-01-17
@ddalle
: UsingKwargHandler
- font_options()¶
Process global font options
- Call:
>>> kw = opts.font_options()
- Inputs:
- opts:
MPLOpts
Options interface
- opts:
- Keys:
%(keys)s
- Outputs:
- kw:
dict
Dictionary of font property options
- kw:
- Versions:
2019-03-07
@ddalle
: First version2019-12-19
@ddalle
: Fromtnakit.mpl.mplopts
2020-01-17
@ddalle
: UsingKwargHandler
- gauss_options()¶
Process options to gaussian plot curve
- Call:
>>> kw = opts.gauss_options()
- Inputs:
- opts:
MPLOpts
Options interface
- opts:
- Keys:
- NGauss, ngauss: {
151
} |int
Number of points to sample Gaussian plot
- HistGaussianOptions: {
None
} |dict
Plot options for gaussian plot on histogram
- Index, i: {
0
} |int
>=0 Index to select specific option from lists
- Rotate, rotate: {
True
} |False
Option to flip x and y axes
- PlotOptions, PlotOpts: {
None
} |dict
Options to
plt.plot()
for primary curve
- NGauss, ngauss: {
- Outputs:
- kw:
dict
Dictionary of options to
plot()
- kw:
- Versions:
2019-03-07
@ddalle
: First version2019-12-19
@ddalle
: Fromtnakit.mpl.mplopts
2020-01-17
@ddalle
: UsingKwargHandler
- grid_options()¶
Process options to axes
grid()
command- Call:
>>> kw = opts.grid_options()
- Inputs:
- opts:
MPLOpts
Options interface
- opts:
- Keys:
- Grid, grid: {
True
} |False
Option to turn on/off axes grid
- GridOptions, GridOpts, MajorGridOpts, MajorGridOptions: {
None
} |dict
Plot options for major grid
- MinorGrid:
`True
| {False
} Turn on/off grid at minor ticks
- MinorGridOptions: {
None
} |dict
Plot options for minor grid
- GridColor: {
None
} |str
|tuple
Color passed to GridOptions
- Grid, grid: {
- Outputs:
- kw:
dict
Dictionary of options to
grid()
- kw:
- Versions:
2019-03-07
@jmeeroff
: First version2019-12-23
@ddalle
: Fromtnakit.mpl.mplopts
2020-01-17
@ddalle
: UsingKwargHandler
- hist_options()¶
Process options for histogram plots
- Call:
>>> kw = opts.hist_options()
- Inputs:
- opts:
MPLOpts
Options interface
- opts:
- Keys:
- HistBins: {
None
} |int
> 0 Number of histogram bins passed to HistOptions
- HistColor: {
None
} |str
|tuple
Histogram passed to HistOptions
- HistOptions: {
None
} |dict
Plot options for histograms
- Rotate, rotate: {
True
} |False
Option to flip x and y axes
- HistBins: {
- Outputs:
- kw:
dict
Dictionary of options to
hist()
- kw:
- Versions:
2020-04-23
@jmeeroff
: First version
- histlabel_options()¶
Process options to gaussian plot curve
- imshow_options()¶
Process options for image display calls
- Call:
>>> kw = opts.imshow_options()
- Inputs:
- opts:
MPLOpts
Options interface
- opts:
- Keys:
- ImageXMin: {
0.0
} |float
Coordinate for left edge of image
- ImageXMax: {
None
} |float
Coordinate for right edge of image
- ImageXCenter: {
None
} |float
Horizontal center coord if x edges not specified
- ImageYMin: {
None
} |float
Coordinate for bottom edge of image
- ImageYMax: {
None
} |float
Coordinate for top edge of image
- ImageYCenter: {
0.0
} |float
Vertical center coord if y edges not specified
- ImageExtent: {
None
} |tuple
|list
Spec for ImageXMin, ImageXMax, ImageYMin, ImageYMax
- ImageXMin: {
- Outputs:
- kw:
dict
Dictionary of options to
imshow()
- kw:
- Versions:
2020-01-09
@ddalle
: First version2020-01-18
@ddalle
: UsingKwargHandler
- interval_options()¶
Process options for
interval()
calls- Call:
>>> kw = opts.interval_options()
- Inputs:
- opts:
MPLOpts
Options interface
- opts:
- Keys:
%(keys)s
- Outputs:
- kw:
dict
Dictionary of options to
fill_between()
- kw:
- Versions:
2019-03-05
@ddalle
: First version2019-12-21
@ddalle
: Fromtnakit.mpl.mplopts
2020-01-17
@ddalle
: UsingKwargHandler
- intervallabel_options()¶
Process options for interval label calls
- Call:
>>> kw = opts.intervallabel_options()
- Inputs:
- opts:
MPLOpts
Options interface
- opts:
- Keys:
%(keys)s
- Outputs:
- kw:
dict
Dictionary of options for interval labels
- kw:
- Versions:
2019-03-05
@ddalle
: First version2019-12-21
@ddalle
: Fromtnakit.mpl.mplopts
2020-01-17
@ddalle
: UsingKwargHandler
- legend_font_options()¶
Process font options for
legend()
calls- Call:
>>> kw = opts.legend_font_options()
- Inputs:
- opts:
MPLOpts
Options interface
- opts:
- Keys:
- LegendFontOptions: {
None
} |dict
Options to
FontProperties
- FontOptions: {
None
} |dict
Options to
FontProperties
- LegendFontName: {
None
} |str
Font name (categories like
sans-serif
allowed)- LegendFontSize: {
None
} |str
|int
|float
Font size (options like
"small"
allowed)- LegendFontStretch: {
None
} |str
|int
|float
Stretch, numeric in range 0-1000 or string such as
"condensed"
,"extra-condensed"
,"semi-expanded"
- LegendFontStyle: {
None
} |"normal"
|"italic"
|"oblique"
Font style/slant
- LegendFontVariant: {
None
} |"normal"
|"small-caps"
Font capitalization variant
- LegendFontWeight: {
None
} |str
|int
|float
Numeric font weight 0-1000 or
"normal"
,"bold"
, etc.
- LegendFontOptions: {
- Outputs:
- kw:
dict
Dictionary of options to
errorbar()
- kw:
- Versions:
2020-01-19
@ddalle
: First version
- legend_options()¶
Process options for
legend()
- Call:
>>> kw = opts.legend_options(kw, kwp={})
- Inputs:
- kw:
dict
Dictionary of options to parent function
- kwp: {
{}
} |dict
Dictionary of options from which to inherit
- kw:
- Keys:
- LegendOptions: {
None
} |dict
Options to
plt.legend()
- LegendAnchor: {
None
} |tuple
(x, y) Location passed to bbox_to_anchor
- LegendFontOptions: {
None
} |dict
Options to
FontProperties
- LegendLocation: {
None
} |str
|int
Numeric location or abbreviation
- LegendOptions: {
- Outputs:
- kw:
dict
Options to
legend()
- kw:
- Versions:
2019-03-07
@ddalle
: First version2019-12-23
@ddalle
: Fromtnakit.mpl.mplopts
2020-01-98
@ddalle
: UsingKwargHandler
- mean_options()¶
Process options plot mean on histogram
- meanlabel_options()¶
Process options to histogram mean labels
- minmax_options()¶
Process options for min/max plots
- Call:
>>> kw = opts.minmax_options()
- Inputs:
- opts:
MPLOpts
Options interface
- opts:
- Keys:
- Index, i: {
0
} |int
>=0 Index to select specific option from lists
- Rotate, rotate: {
True
} |False
Option to flip x and y axes
- MinMaxOptions, MinMaxOpts: {
None
} |dict
Options for error-bar or fill-between min/max plot
- MinMaxPlotType: {
"FillBetween"
} |"ErrorBar"
Plot type for min/max plot
- ErrorBarOptions, ErrorBarOpts: {
None
} |dict
Options for
errorbar()
plots- ErrorBarMarker: {
None
} |str
Marker for
errorbar()
plots- FillBetweenOptions, FillBetweenOpts: {
None
} |dict
Options for
fill_between()
plots- PlotOptions, PlotOpts: {
None
} |dict
Options to
plt.plot()
for primary curve
- Index, i: {
- Outputs:
- kw:
dict
Dictionary of options to
minmax()
- kw:
- Versions:
2019-03-04
@ddalle
: First version2019-12-20
@ddalle
: Fromtnakit.mpl.mplopts
2020-01-17
@ddalle
: UsingKwargHandler
- plot_options()¶
Process options to primary plot curve
- Call:
>>> kw = opts.plot_options()
- Inputs:
- opts:
MPLOpts
Options interface
- opts:
- Keys:
- Index, i: {
0
} |int
>=0 Index to select specific option from lists
- Rotate, rotate: {
True
} |False
Option to flip x and y axes
- PlotOptions, PlotOpts: {
None
} |dict
Options to
plt.plot()
for primary curve- PlotFormat, fmt: {
None
} |str
Format specifier as third arg to
plot()
- Label, label, lbl: {
None
} |str
Label passed to
plt.legend()
- PlotColor: {
None
} |str
|tuple
Color option to
plt.plot()
for primary curve- PlotLineWidth: {
None
} |int
> 0 |float
> 0.0 Line width for primary
plt.plot()
- PlotLineStyle:
":"
|"-"
|"none"
|"-."
|"--"
Line style for primary
plt.plot()
- Index, i: {
- Outputs:
- kw:
dict
Dictionary of options to
plot()
- kw:
- Versions:
2019-03-07
@ddalle
: First version2019-12-19
@ddalle
: Fromtnakit.mpl.mplopts
2020-01-17
@ddalle
: UsingKwargHandler
- scatter_options()¶
Process options for
scatter()
calls- Call:
>>> kw = opts.scatter_options()
- Inputs:
- opts:
MPLOpts
Options interface
- opts:
- Keys:
%(keys)s
- Outputs:
- kw:
dict
Dictionary of options to
scatter()
- kw:
- Versions:
2019-03-05
@ddalle
: First version2019-12-21
@ddalle
: Fromtnakit.mpl.mplopts
2020-01-17
@ddalle
: UsingKwargHandler
- sigma_options()¶
Process options for
sigma()
calls- Call:
>>> kw = opts.sigma_options()
- Inputs:
- opts:
MPLOpts
Options interface
- opts:
- Keys:
%(keys)s
- Outputs:
- kw:
dict
Dictionary of options to
_plot()
- kw:
- Versions:
2019-03-05
@ddalle
: First version2019-12-21
@ddalle
: Fromtnakit.mpl.mplopts
2020-01-17
@ddalle
: UsingKwargHandler
- sigmalabel_options()¶
Process options for
sigma()
labels- Call:
>>> kw = opts.sigma_options()
- Inputs:
- opts:
MPLOpts
Options interface
- opts:
- Keys:
%(keys)s
- Outputs:
- kw:
dict
Dictionary of options to
axlabel`()
- kw:
- Versions:
2019-03-05
@ddalle
: First version2019-12-21
@ddalle
: Fromtnakit.mpl.mplopts
2020-01-17
@ddalle
: UsingKwargHandler
- spine_options()¶
Process options for axes “spines”
- Call:
>>> kw = opts.spine_options()
- Inputs:
- opts:
MPLOpts
Options interface
- opts:
- Keys:
- Spines: {
True
} |False
Turn on/off all spines
- SpineOptions: {
None
} |dict
Options for all spines
- BottomSpine: {
None
} |True
|False
|"clipped"
Turn on/off bottom plot spine
- BottomSpineMax: {
None
} |float
Maximum x coord for bottom plot spine
- BottomSpineMin: {
None
} |float
Minimum x coord for bottom plot spine
- BottomSpineOptions: {
None
} |dict
Additional options for bottom spine
- BottomSpineTicks, BottomTicks: {
None
} |True
|False
Turn on/off labels on bottom spine
- BottomTickLabels: {
None
} |True
|False
Turn on/off tick labels on bottom spine
- LeftSpine: {
None
} |True
|False
|"clipped"
Turn on/off left plot spine
- LeftSpineMax: {
None
} |float
Maximum y coord for left plot spine
- LeftSpineMin: {
None
} |float
Minimum y coord for left plot spine
- LeftSpineOptions: {
None
} |dict
Additional options for left spine
- LeftSpineTicks, LeftTicks: {
None
} |True
|False
Turn on/off labels on left spine
- LeftTickLabels: {
None
} |True
|False
Turn on/off tick labels on left spine
- RightSpine: {
None
} |True
|False
|"clipped"
Turn on/off right plot spine
- RightSpineMax: {
None
} |float
Maximum y coord for right plot spine
- RightSpineMin: {
None
} |float
Minimum y coord for right plot spine
- RightSpineOptions: {
None
} |dict
Additional options for right spine
- RightSpineTicks, RightTicks: {
None
} |True
|False
Turn on/off labels on right spine
- RightTickLabels: {
None
} |True
|False
Turn on/off tick labels on right spine
- TopSpine: {
None
} |True
|False
|"clipped"
Turn on/off top plot spine
- TopSpineMax: {
None
} |float
Maximum x coord for top plot spine
- TopSpineMin: {
None
} |float
Minimum x coord for top plot spine
- TopSpineOptions: {
None
} |dict
Additional options for top spine
- TopSpineTicks, TopTicks: {
None
} |True
|False
Turn on/off labels on top spine
- TopTickLabels: {
None
} |True
|False
Turn on/off tick labels on top spine
- Spines: {
- Outputs:
- kw:
dict
Dictionary of options to each of four spines
- kw:
- Versions:
2019-03-07
@jmeeroff
: First version2019-12-20
@ddalle
: Fromtnakit.mpl.mplopts
2020-01-20
@ddalle
: UsingKwargHandler
- uq_options()¶
Process options for uncertainty quantification plots
- Call:
>>> kw = opts.uq_options()
- Inputs:
- opts:
MPLOpts
Options interface
- opts:
- Keys:
- Index, i: {
0
} |int
>=0 Index to select specific option from lists
- Rotate, rotate: {
True
} |False
Option to flip x and y axes
- ErrorBarMarker: {
None
} |str
Marker for
errorbar()
plots- ErrorBarOptions, ErrorBarOpts: {
None
} |dict
Options for
errorbar()
plots- FillBetweenOptions, FillBetweenOpts: {
None
} |dict
Options for
fill_between()
plots- UncertaintyPlotType, UQPlotType: {
"FillBetween"
} |"ErrorBar"
Plot type for UQ plots
- UncertaintyOptions, UQOptions, UQOpts, UncertaintyOpts: {
None
} |dict
Options for UQ plots
- PlotOptions, PlotOpts: {
None
} |dict
Options to
plt.plot()
for primary curve
- Index, i: {
- Outputs:
- kw:
dict
Dictionary of options to
uq()
- kw:
- Versions:
2019-03-04
@ddalle
: First version2019-12-23
@ddalle
: Fromtnakit.mpl.mplopts
2020-01-17
@ddalle
: UsingKwargHandler
- cape.tnakit.plot_mpl.axes(**kw)¶
Create new axes or edit one if necessary
- Call:
>>> ax = axes(**kw)
- Inputs:
- ax, Axes: {
None
} |matplotlib.axes._subplots.Axes
Handle to existing axes
- AxesOptions: {
None
} |dict
Options to
AxesSubplot
- ax, Axes: {
- Outputs:
- ax:
matplotlib.axes._subplots.AxesSubplot
Axes handle
- ax:
- Versions:
2019-03-06
@ddalle
: First version2020-01-24
@ddalle
: Moved toplot_mpl.mpl
- cape.tnakit.plot_mpl.figure(**kw)¶
Get or create figure handle and format it
- Call:
>>> fig = figure(**kw)
- Inputs:
- fig, Figure: {
None
} |matplotlib.figure.Figure
Handle to existing figure
- FigOptions: {
None
} |dict
Options to
matplotlib.figure.Figure
- FigNumber, nfig, numfig: {
None
} |int
> 0 Figure number
- FigWidth, wfig: {
None
} |float
> 0.0 Figure width [inches]
- FigHeight, hfig: {
None
} |float
> 0.0 Figure height [inches]
- FigDPI: {
None
} |int
> 0 |float
> 0.0 Figure resolution in dots per inch
- fig, Figure: {
- Outputs:
- fig:
matplotlib.figure.Figure
Figure handle
- fig:
- Versions:
2019-03-06
@ddalle
: First version2020-01-24
@ddalle
: Added options checks
- cape.tnakit.plot_mpl.plot(xv, yv, *a, **kw)¶
Plot connected points with many options
- Call:
>>> h, kw = plot(xv, yv, *a, **kw)
- Inputs:
- xv:
np.ndarray
[float
] Array of values for x-axis
- yv:
np.ndarray
[float
] Array of values for y-axis
- xv:
- Outputs:
- h:
cape.tnakit.plot_mpl.MPLHandle
Dictionary of plot handles
- h:
- Versions:
2019-03-01
@ddalle
: First (independent) version2019-12-23
@ddalle
: Object-oriented options and output