AbstractPlot — Plotting base class.¶
This module defines the base class for ADMIT plotters (APlot, ImPlot):
- keeps track of figure numbers
- plotmodes as in util.PlotControl
- thumbnail generation built-in
-
class
admit.util.AbstractPlot.AbstractPlot(pmode=None, ptype=None, figno=None, abspath='')[source]¶ Base class of ADMIT plotters.
Attributes
figno (int) Figure number (1 and up). This is a static class variable. _figurefiles (dict) Dictionary of figure file names with key equal to figno. _thumbnailfiles (dict) Dictionary of thumbnail file names with key equal to figno. _plot_mode (int) Plot mode, one of util.PlotControl plot mode (e.g., PlotControl.INTERACTIVE). Default: PlotControl.NOPLOT . _plot_type (int) Plotting format, one of util.PlotControl plot type (e.g., PlotControl.PNG). Default: PlotControl.NONE. _abspath (str) Fully-qualified path where images will be written. Default: empty string, meaning write in current working directory or the path will be given in the figname argument to plot methods. Methods
backend(thebackend)figure([figno])set the figure number. getFigure(figno, relative)Get the name of the figure file for given figure number getThumbnail(figno, relative)Get the name of the thumbnail file for given figure number makeThumbnail([figno, scale, fig])Create a thumbnail for a given figure number. show()show internals for debugging -
figno= 0¶
-
figure(figno=1)[source]¶ set the figure number. This should normally not be needed, unless you want to alternate drawing in different figures. This option has not been tested at all.
-
getFigure(figno, relative)[source]¶ Get the name of the figure file for given figure number
Parameters: figno : int
Figure number to look up
relative : boolean
Whether to return with relative path or absolute path. If True, plot _abspath will be removed from retured string.
Returns: str
Figure file name
-
getThumbnail(figno, relative)[source]¶ Get the name of the thumbnail file for given figure number
Parameters: figno : int
Figure number to look up
relative : boolean
Whether to return with relative path or absolute path. If True, plot _abspath will be removed from retured string.
Returns: str
Thumbnail file name
-
makeThumbnail(figno=None, scale=0.33, fig=None)[source]¶ Create a thumbnail for a given figure number. The output file will be root of input plus ‘_thumb’ plus plot type extension. For instance, if the input were “myimage.png”, the output would be “myimage_thumb.png”. Note: only PNG format is currently supported (matplotlib restriction, Exception raised otherwise).
Parameters: figno: int
figure number for a plot that has been created by this Plot instance.
scale: float
multiplier to scale input image, e.g. for 50% scaling, scale = 0.5. Default: 0.33
fig : figure, optional
Populated matplotlib.figure.Figure instance (if None, input plot type must be PNG).
Returns: None
-
plotmode¶ Get the plotting mode
Returns: int
Plotting mode.
See also
util.PlotControl
-
plottype¶ Get the plot type
Returns: int
Plot format type.
See also
util.PlotControl
-