On May 21, 2008, at 2:50 PM, Tony S Yu wrote:
I want to use the FiPy Matplotlib viewer to plot the solution to a
1D problem (but I think the same applies in 2D). After making a
viewer, a call to the plot method of the viewer (e.g. viewer.plot())
simply opens up a plot window, which is closed after the script has
completed. The problem is that nothing ever gets plotted to the
window. If instead I call viewer.plot('some_filename'), an image of
the plot gets saved to 'some_filename'.
What you're describing *should* work (and works for me).
Shouldn't the plot method show the plot when called with no arguments.
It shouldn't be necessary (the `pylab.draw()` and `pylab.ion()` have
always been effective for us in getting the screen to display).
Specs:
Leopard 10.5
Python 2.5.1
FiPy trunk
Matplotlib 0.91.1
That's almost exactly what I'm running (I've got Leopard 10.5.2 and
Python 2.5.0), and matplotlib works fine for me (with the exception of
some warnings I haven't figured out yet). Can you tell us a bit more
about what you're doing? This is the test I just ran:
>>> from fipy import *
>>> mesh = Grid1D(nx=10, dx=0.1)
>>> x, = mesh.getCellCenters()
>>> var = CellVariable(mesh=mesh, value=x**2)
>>> viewer = viewers.make(vars=var)
/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-
packages/pytz-2008a-py2.5.egg/pytz/__init__.py:29: UserWarning: Module
pytz was already imported from /Library/Frameworks/Python.framework/
Versions/2.5/lib/python2.5/site-packages/pytz-2008a-py2.5.egg/pytz/
__init__.py, but /Users/guyer/Documents/research/FiPy/trunk is being
added to sys.path
/Users/guyer/Documents/research/FiPy/trunk/fipy/viewers/
matplotlibViewer/__init__.py:36: UserWarning: Matplotlib1DViewer
efficiency is improved by setting the 'datamax' and 'datamin' keys
return Matplotlib1DViewer(vars = vars, title = title, limits =
limits)
>>> viewer.plot()