On 04/10/2006 22:54 Daniel Wheeler wrote the following:
Not sure if I understand your solution properly. I replaced the viewer part with your code and the figure looks better but without a color bar. The error message prompted is listed below:- Traceback (most recent call last): File "C:/Python23/hzh/Q061004-fixed.py", line 26, in ? viewer = Matplotlib2DViewer(vars=c, limits={'datamin':0., 'datamax':1.}) File "C:\Python23\Lib\site-packages\fipy\viewers\matplotlibViewer\matplotlib2DViewer.py", line 83, in __init__ self.colorbar = pylab.colorbar(array(self.vars[0])) File "C:\Python23\Lib\site-packages\matplotlib\pylab.py", line 363, in colorbar edgecolor=edgecolor) File "C:\Python23\Lib\site-packages\matplotlib\figure.py", line 701, in colorbar cmap = mappable.cmap AttributeError: cmap The updated code is as below:- H=0.25 Calpha0=0.002 Cimc0=0.4105 Cliq0=0.9769 nx=16 ny=90 dx=H dy=dx from fipy.meshes.grid2D import Grid2D mesh=Grid2D(dx=dx, dy=dy, nx=nx, ny=ny) from fipy.variables.cellVariable import CellVariable c=CellVariable(name="Concentration", mesh=mesh, value=Calpha0) y=mesh.getCellCenters()[...,1] c.setValue(Cimc0, where=(41*H<y) & (y<45*H)) c.setValue(Cliq0, where=(y>45*H)) from fipy.viewers.matplotlibViewer.matplotlib2DViewer import Matplotlib2DViewer viewer = Matplotlib2DViewer(vars=c, limits={'datamin':0., 'datamax':1.}) viewer.plot() |
- Re: Fipy v1.1 installation problem? Daniel Wheeler
- Re: Fipy v1.1 installation problem? Daniel Wheeler
- Re: Fipy v1.1 installation problem? hzhatlboro
- Re: Fipy v1.1 installation problem? Daniel Wheeler
- Re: Fipy v1.1 installation problem? Jonathan Guyer
- Re: Fipy v1.1 installation problem? hzhatlboro
- Beginner's question---Initial condition setting hzhatlboro
- Re: Beginner's question---Initial condition se... Jonathan Guyer
- Re: Beginner's question---Initial conditio... Jonathan Guyer
- Re: Beginner's question---Initial con... Daniel Wheeler
- Re: Beginner's question---Initial... hzhatlboro
- Re: Beginner's question---Initial... Daniel Wheeler
- Re: Beginner's question---Initial... Daniel Wheeler
- Re: Beginner's question---Initial... hzhatlboro
- Re: Beginner's question---Initial... Daniel Wheeler
