Hi, This is what I get when I type print viewer.
<fipy.viewers.matplotlibViewer.matplotlib2DGridViewer.Matplotlib2DGridViewer instance at 0x05BDBDC8> But I don't get the error message. That makes sense since Matplotlib2DGridViewer is being assigned to viewer. But I don't know what it is that I changed that is causing the error to go away. Ram. So apparently it is getting assigned. On Fri, Dec 17, 2010 at 12:02 PM, Jonathan Guyer <[email protected]> wrote: > > The AttributeError is because the Matplotlib2DGridViewer has never been > assigned to `viewer` for some reason, so the script thinks `viewer` is the > module `fipy.viewer`, imported by `from fipy import *`. > > As to *why* it's not being assigned. I can't guess. What happens when you > just enter: > > >> from matplotlib import pylab > >> 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 = Matplotlib2DGridViewer(vars=sin(k*xyVar), > >> limits={'ymin':0.1, 'ymax':0.9}, > >> datamin=-0.9, datamax=2.0, > >> title="Matplotlib2DGridViewer test") > > in a fresh shell. Is any error or message issued? > > What does it say if you enter > > >> print viewer > > ? > > > > > On Dec 17, 2010, at 11:59 AM, Daniel Wheeler wrote: > > > > > Hi Ram, I don't seem to have any problems with trunk/ or version-2_1/ > > on linux running the script below. I am not surprised by the issues on > > Windows. These are almost certainly issues with matplotlib rendering, > > but I am confused by the "AttributeError:". It doesn't seem to make > > much sense. I need to fix a number of issues on Windows. Hopefully, > > I'll get to it in the not too distant future. Cheers. > > > > On Thu, Dec 16, 2010 at 3:12 PM, Ram Balachandran > > <[email protected]> wrote: > >> Hello, > >> > >> I am trying to use Matplotlib for plotting purposes and I am > encountering > >> problems with it. I tried to run a simple case listed in the fipy > >> documentation (section 25.3 - page 305). Please find below the sample > code > >> > >> from matplotlib import pylab > >> 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 = Matplotlib2DGridViewer(vars=sin(k*xyVar), > >> limits={'ymin':0.1, 'ymax':0.9}, > >> datamin=-0.9, datamax=2.0, > >> title="Matplotlib2DGridViewer test") > >> > >> for kval in range(10): > >> k.setValue(kval) > >> viewer.plot() > >> viewer._promptForOpinion() > >> > >> The code runs and I see the plot but I get the following message > >> > >> Traceback (most recent call last): > >> File "c:\somewhere\matplotlib_plot.py", line 36, in <module> > >> viewer.plot() > >> AttributeError: 'module' object has no attribute 'plot' > >> > >> The other issue is that I am unable to close the figure window that > opens. > >> The program stops to respond and I am having to forcefully close the > entire > >> application. > >> > >> I am running fipy 2.1.1 along with Enthought python distribution 6.3.1 > which > >> comes with python 2.6 on a windows - 64bit machine. > >> > >> Any help will be greatly appreciated. > >> > >> Thanks > >> Ram. > >> > > > > > > > > -- > > Daniel Wheeler > > > > > > > >
