examples.phase.phaseViewer¶
1D Viewer that calculates and plots the position of the phase field interface.
Classes
|
>>> import fipy as fp
|
- class examples.phase.phaseViewer.PhaseViewer(phase, C, sharp, elapsed, L, deltaA, title=None, tmin=None, tmax=None, **kwlimits)¶
Bases:
Matplotlib1DViewer>>> 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 = PhaseViewer(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="PhaseViewer 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 = "PhaseViewer changed" >>> viewer.plot() >>> viewer._promptForOpinion()
- Parameters:
vars (
CellVariableorlist) – 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 MatplotlibAxesobject
- property axes¶
The Matplotlib
Axes.
- property cmap¶
The Matplotlib
Colormap.
- property colorbar¶
The Matplotlib
Colorbar.
- property fig¶
The Matplotlib
Figure.
- property id¶
The Matplotlib
Figurenumber.
- property lines¶
The collection of Matplotlib
Line2Dobjects 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.
FiPy