fipy.viewers.matplotlibViewer.matplotlib1DViewer¶
Classes
|
Displays a y vs. |
- class fipy.viewers.matplotlibViewer.matplotlib1DViewer.Matplotlib1DViewer(vars, title=None, xlog=False, ylog=False, limits={}, legend='upper left', axes=None, **kwlimits)¶
Bases:
AbstractMatplotlibViewer
Displays a y vs. x plot of one or more 1D CellVariable objects using Matplotlib.
>>> import fipy as fp >>> mesh = fp.Grid1D(nx=100) >>> x, = mesh.cellCenters >>> xVar = fp.CellVariable(mesh=mesh, name="x", value=x) >>> k = fp.Variable(name="k", value=0.) >>> viewer = Matplotlib1DViewer(vars=(fp.numerix.sin(k * xVar) + 2, ... fp.numerix.cos(k * xVar / fp.numerix.pi) + 2), ... xmin=10, xmax=90, ... datamin=1.1, datamax=4.0, ... title="Matplotlib1DViewer test") >>> for kval in fp.numerix.arange(0, 0.3, 0.03): ... k.setValue(kval) ... viewer.plot() >>> viewer._promptForOpinion()
>>> viewer.cmap = "ocean" >>> viewer.log = True
>>> viewer.title = "Matplotlib1DViewer changed" >>> viewer.plot() >>> viewer._promptForOpinion()
- Parameters:
vars (
CellVariable
orlist
) – CellVariable objects to plottitle (
str
, optional) – displayed at the top of the Viewer windowxlog (
bool
) – log scaling of x axis if Trueylog (
bool
) – log scaling of y axis if Truelimits (
dict
) – a (deprecated) alternative to limit keyword argumentsxmin (
float
, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale. (ymin and ymax are synonyms for datamin and datamax).xmax (
float
, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale. (ymin and ymax are synonyms for datamin and datamax).datamin (
float
, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale. (ymin and ymax are synonyms for datamin and datamax).datamax (
float
, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale. (ymin and ymax are synonyms for datamin and datamax).legend (
str
) – place a legend at the specified position, if not Noneaxes (
Axes
) – if not None, vars will be plotted into this MatplotlibAxes
object
- property axes¶
The Matplotlib
Axes
.
- property cmap¶
The Matplotlib
Colormap
.
- property colorbar¶
The Matplotlib
Colorbar
.
- property fig¶
The Matplotlib
Figure
.
- property id¶
The Matplotlib
Figure
number.
- property lines¶
The collection of Matplotlib
Line2D
objects representing the plotted data.
- property log¶
Whether data has logarithmic scaling
- plot(filename=None)¶
Update the display of the viewed variables.
- Parameters:
filename (
str
) – If not None, the name of a file to save the image into.
- plotMesh(filename=None)¶
Display a representation of the mesh
- Parameters:
filename (
str
) – If not None, the name of a file to save the image into.
- setLimits(limits={}, **kwlimits)¶
Update the limits.
- Parameters:
limits (
dict
, optional) – a (deprecated) alternative to limit keyword argumentsxmin (
float
, optional) – displayed range of data. A 1D Viewer will only use xmin and xmax, a 2D viewer will also use ymin and ymax, and so on. All viewers will use datamin and datamax. Any limit set to a (default) value of None will autoscale.xmax (
float
, optional) – displayed range of data. A 1D Viewer will only use xmin and xmax, a 2D viewer will also use ymin and ymax, and so on. All viewers will use datamin and datamax. Any limit set to a (default) value of None will autoscale.ymin (
float
, optional) – displayed range of data. A 1D Viewer will only use xmin and xmax, a 2D viewer will also use ymin and ymax, and so on. All viewers will use datamin and datamax. Any limit set to a (default) value of None will autoscale.ymax (
float
, optional) – displayed range of data. A 1D Viewer will only use xmin and xmax, a 2D viewer will also use ymin and ymax, and so on. All viewers will use datamin and datamax. Any limit set to a (default) value of None will autoscale.zmin (
float
, optional) – displayed range of data. A 1D Viewer will only use xmin and xmax, a 2D viewer will also use ymin and ymax, and so on. All viewers will use datamin and datamax. Any limit set to a (default) value of None will autoscale.zmax (
float
, optional) – displayed range of data. A 1D Viewer will only use xmin and xmax, a 2D viewer will also use ymin and ymax, and so on. All viewers will use datamin and datamax. Any limit set to a (default) value of None will autoscale.datamin (
float
, optional) – displayed range of data. A 1D Viewer will only use xmin and xmax, a 2D viewer will also use ymin and ymax, and so on. All viewers will use datamin and datamax. Any limit set to a (default) value of None will autoscale.datamax (
float
, optional) – displayed range of data. A 1D Viewer will only use xmin and xmax, a 2D viewer will also use ymin and ymax, and so on. All viewers will use datamin and datamax. Any limit set to a (default) value of None will autoscale.