Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MatplotlibGrid2DViewer error with Matplotlib version 1.4.0 #415

Closed
wd15 opened this issue Sep 19, 2014 · 3 comments · Fixed by #419
Closed

MatplotlibGrid2DViewer error with Matplotlib version 1.4.0 #415

wd15 opened this issue Sep 19, 2014 · 3 comments · Fixed by #419

Comments

@wd15
Copy link
Contributor

wd15 commented Sep 19, 2014

The following fails

import matplotlib.pyplot as plt
import fipy as fp

L = 1.
nx = 400
dx = L/nx
dy = L/nx
mesh = fp.Grid2D(dx=dx, dy=dx, nx=nx, ny=nx)
phase = fp.CellVariable(name="phase", mesh=mesh)
x = mesh.cellCenters()[0]
y = mesh.cellCenters()[1]
phase.setValue(1.)
x0 = 0.0
y0 = 0.0
phase.setValue(0., where=(
((x-x0)**2+(y-y0)**2 > L/3) & ((x-L)**2+(y-L)**2 > 0.2)
)
)
viewer = fp.Matplotlib2DGridViewer(vars=phase)
viewer.plot()
plt.show()

with

Traceback (most recent call last):
...
  File "/home/wd15/anaconda/lib/python2.7/site-packages/matplotlib/transforms.py", line 2642, in nonsingular
if (not np.isfinite(vmin)) or (not np.isfinite(vmax)):
TypeError: ufunc 'isfinite' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule _safe_

This was reported on the mailing list, http://thread.gmane.org/gmane.comp.python.fipy/3599

Imported from trac ticket #672, created by wd15 on 09-12-2014 at 22:08, last modified: 09-12-2014 at 23:58

@fipymigrate
Copy link

In db6e599:

#CommitTicketReference repository="fipy" revision="db6e5992a4ace2160afff3c111f02f437a3a27e9"
Bug with Matplotliv 1.4.0 is fixed

Fix issue #415

Bug with Matplotlib version 1.4.0 is fixed. the bug was caused because
the default value of vmin and vmax is None internally to
Matplotlib. Some code in matplotlib tries a numpy operation on these
None values. A simple fix is to pass a norm instance to the
ColorbarBase class when it is called in FiPy. This may be an internal
bug to Matplotlib.

The fix works was tried with both Matplotlib version 1.4.0 and 1.3.1.

Trac comment by Daniel Wheeler daniel.wheeler2@gmail.com on 09-12-2014 at 23:52

@wd15
Copy link
Contributor Author

wd15 commented Sep 19, 2014

Pull request.

The following changes since commit 08d564f9f2d6512c66ee8239108ed21996c88e58:

  Merge branch 'ticket665-forgot-tests' into develop (2014-01-29 13:47:14 -0500)

are available in the git repository at:


  ssh://git@code.matforge.org/nist/fipy.git ticket672-matplotlib-1_4_0-error

for you to fetch changes up to db6e5992a4ace2160afff3c111f02f437a3a27e9:

  Bug with Matplotliv 1.4.0 is fixed (2014-09-12 23:45:09 -0400)

----------------------------------------------------------------
Daniel Wheeler (1):
Bug with Matplotliv 1.4.0 is fixed

 fipy/viewers/matplotlibViewer/matplotlibViewer.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Trac comment by wd15 on 09-12-2014 at 23:57

@guyer
Copy link
Member

guyer commented Aug 9, 2015

Fixed a year ago by #419

@guyer guyer closed this as completed Aug 9, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants