Bookmark and Share FiPy: A Finite Volume PDE Solver Using Python
Version 2.1.3

This Page

Contact

FiPy developers
Jonathan Guyer
Daniel Wheeler
James Warren

Join our mailing list

100 Bureau Drive, M/S 6555
Gaithersburg, MD 20899

301-975-5329 Telephone
301-975-4553 Facsimile

gnuplotViewer Package Documentation

This page contains the gnuplotViewer Package documentation.

The gnuplotViewer Package

fipy.viewers.gnuplotViewer.GnuplotViewer(vars, title=None, limits={}, **kwlimits)

Generic function for creating a GnuplotViewer.

The GnuplotViewer factory will search the module tree and return an instance of the first GnuplotViewer it finds of the correct dimension.

Parameters :
vars

a CellVariable or tuple of CellVariable objects to plot

title

displayed at the top of the Viewer window

limits : dict

a (deprecated) alternative to limit keyword arguments

xmin, xmax, ymin, ymax, datamin, datamax

displayed range of data. A 1D Viewer will only use xmin and xmax, a 2D viewer will also use ymin and ymax. All viewers will use datamin and datamax. Any limit set to a (default) value of None will autoscale.

class fipy.viewers.gnuplotViewer.Gnuplot1DViewer(vars, title=None, **kwlimits)

Bases: fipy.viewers.gnuplotViewer.gnuplotViewer._GnuplotViewer

Displays a y vs. x plot of one or more 1D CellVariable objects.

The Gnuplot1DViewer plots a 1D CellVariable using a front end python wrapper available to download (Gnuplot.py).

>>> from fipy import *
>>> mesh = Grid1D(nx=100)
>>> x, = mesh.getCellCenters()
>>> xVar = CellVariable(mesh=mesh, name="x", value=x)
>>> k = Variable(name="k", value=0.)
>>> viewer = Gnuplot1DViewer(vars=(sin(k * xVar), cos(k * xVar / pi)), 
...                 limits={'xmin': 10, 'xmax': 90}, 
...                 datamin=-0.9, datamax=2.0,
...                 title="Gnuplot1DViewer test")
>>> for kval in numerix.arange(0,0.3,0.03):
...     k.setValue(kval)
...     viewer.plot()
>>> viewer._promptForOpinion()

Different style script demos are available at the Gnuplot site.

Note

Gnuplot1DViewer requires Gnuplot version 4.0.

The _GnuplotViewer should not be called directly only Gnuplot1DViewer and Gnuplot2DViewer should be called.

Parameters :
vars

a CellVariable or tuple of CellVariable objects to plot

title

displayed at the top of the Viewer window

xmin, xmax, ymin, ymax, datamin, datamax

displayed range of data. A 1D Viewer will only use xmin and xmax, a 2D viewer will also use ymin and ymax. All viewers will use datamin and datamax. Any limit set to a (default) value of None will autoscale.

class fipy.viewers.gnuplotViewer.Gnuplot2DViewer(vars, title=None, limits={}, **kwlimits)

Bases: fipy.viewers.gnuplotViewer.gnuplotViewer._GnuplotViewer

Displays a contour plot of a 2D CellVariable object.

The Gnuplot2DViewer plots a 2D CellVariable using a front end python wrapper available to download (Gnuplot.py).

>>> from fipy import *
>>> mesh = Grid2D(nx=50, ny=100, dx=0.1, dy=0.01)
>>> x, y = mesh.getCellCenters()
>>> xyVar = CellVariable(mesh=mesh, name="x y", value=x * y)
>>> k = Variable(name="k", value=0.)
>>> viewer = Gnuplot2DViewer(vars=sin(k * xyVar), 
...                 limits={'ymin': 0.1, 'ymax': 0.9}, 
...                 datamin=-0.9, datamax=2.0,
...                 title="Gnuplot2DViewer test")
>>> for kval in range(10):
...     k.setValue(kval)
...     viewer.plot()
>>> viewer._promptForOpinion()
>>> from fipy import *
>>> mesh = (Grid2D(nx=5, ny=10, dx=0.1, dy=0.1)
...         + (Tri2D(nx=5, ny=5, dx=0.1, dy=0.1) 
...          + ((0.5,), (0.2,))))
>>> x, y = mesh.getCellCenters()
>>> xyVar = CellVariable(mesh=mesh, name="x y", value=x * y)
>>> k = Variable(name="k", value=0.)
>>> viewer = Gnuplot2DViewer(vars=sin(k * xyVar), 
...                 limits={'ymin': 0.1, 'ymax': 0.9}, 
...                 datamin=-0.9, datamax=2.0,
...                 title="Gnuplot2DViewer test")
>>> for kval in range(10):
...     k.setValue(kval)
...     viewer.plot()
>>> viewer._promptForOpinion()

Different style script demos are available at the Gnuplot site.

Note

Gnuplot2DViewer requires Gnuplot version 4.0.

Creates a Gnuplot2DViewer.

Parameters :
vars

a CellVariable object.

title

displayed at the top of the Viewer window

limits : dict

a (deprecated) alternative to limit keyword arguments

xmin, xmax, ymin, ymax, datamin, datamax

displayed range of data. Any limit set to a (default) value of None will autoscale.

The gnuplot1DViewer Module

class fipy.viewers.gnuplotViewer.gnuplot1DViewer.Gnuplot1DViewer(vars, title=None, **kwlimits)

Bases: fipy.viewers.gnuplotViewer.gnuplotViewer._GnuplotViewer

Displays a y vs. x plot of one or more 1D CellVariable objects.

The Gnuplot1DViewer plots a 1D CellVariable using a front end python wrapper available to download (Gnuplot.py).

>>> from fipy import *
>>> mesh = Grid1D(nx=100)
>>> x, = mesh.getCellCenters()
>>> xVar = CellVariable(mesh=mesh, name="x", value=x)
>>> k = Variable(name="k", value=0.)
>>> viewer = Gnuplot1DViewer(vars=(sin(k * xVar), cos(k * xVar / pi)), 
...                 limits={'xmin': 10, 'xmax': 90}, 
...                 datamin=-0.9, datamax=2.0,
...                 title="Gnuplot1DViewer test")
>>> for kval in numerix.arange(0,0.3,0.03):
...     k.setValue(kval)
...     viewer.plot()
>>> viewer._promptForOpinion()

Different style script demos are available at the Gnuplot site.

Note

Gnuplot1DViewer requires Gnuplot version 4.0.

The _GnuplotViewer should not be called directly only Gnuplot1DViewer and Gnuplot2DViewer should be called.

Parameters :
vars

a CellVariable or tuple of CellVariable objects to plot

title

displayed at the top of the Viewer window

xmin, xmax, ymin, ymax, datamin, datamax

displayed range of data. A 1D Viewer will only use xmin and xmax, a 2D viewer will also use ymin and ymax. All viewers will use datamin and datamax. Any limit set to a (default) value of None will autoscale.

The gnuplot2DViewer Module

class fipy.viewers.gnuplotViewer.gnuplot2DViewer.Gnuplot2DViewer(vars, title=None, limits={}, **kwlimits)

Bases: fipy.viewers.gnuplotViewer.gnuplotViewer._GnuplotViewer

Displays a contour plot of a 2D CellVariable object.

The Gnuplot2DViewer plots a 2D CellVariable using a front end python wrapper available to download (Gnuplot.py).

>>> from fipy import *
>>> mesh = Grid2D(nx=50, ny=100, dx=0.1, dy=0.01)
>>> x, y = mesh.getCellCenters()
>>> xyVar = CellVariable(mesh=mesh, name="x y", value=x * y)
>>> k = Variable(name="k", value=0.)
>>> viewer = Gnuplot2DViewer(vars=sin(k * xyVar), 
...                 limits={'ymin': 0.1, 'ymax': 0.9}, 
...                 datamin=-0.9, datamax=2.0,
...                 title="Gnuplot2DViewer test")
>>> for kval in range(10):
...     k.setValue(kval)
...     viewer.plot()
>>> viewer._promptForOpinion()
>>> from fipy import *
>>> mesh = (Grid2D(nx=5, ny=10, dx=0.1, dy=0.1)
...         + (Tri2D(nx=5, ny=5, dx=0.1, dy=0.1) 
...          + ((0.5,), (0.2,))))
>>> x, y = mesh.getCellCenters()
>>> xyVar = CellVariable(mesh=mesh, name="x y", value=x * y)
>>> k = Variable(name="k", value=0.)
>>> viewer = Gnuplot2DViewer(vars=sin(k * xyVar), 
...                 limits={'ymin': 0.1, 'ymax': 0.9}, 
...                 datamin=-0.9, datamax=2.0,
...                 title="Gnuplot2DViewer test")
>>> for kval in range(10):
...     k.setValue(kval)
...     viewer.plot()
>>> viewer._promptForOpinion()

Different style script demos are available at the Gnuplot site.

Note

Gnuplot2DViewer requires Gnuplot version 4.0.

Creates a Gnuplot2DViewer.

Parameters :
vars

a CellVariable object.

title

displayed at the top of the Viewer window

limits : dict

a (deprecated) alternative to limit keyword arguments

xmin, xmax, ymin, ymax, datamin, datamax

displayed range of data. Any limit set to a (default) value of None will autoscale.

The gnuplotViewer Module

The test Module

Test numeric implementation of the mesh