Opened 5 months ago

Last modified 5 months ago

#672 reopened defect

MatplotlibGrid2DViewer error with Matplotlib version 1.4.0

Reported by: wd15 Owned by: Daniel Wheeler <daniel.wheeler2@…>
Priority: 1 Milestone:
Component: viewers Version:
Severity: Bugs Keywords:
Cc:

Description

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

Change History (3)

comment:1 Changed 5 months ago by Daniel Wheeler <daniel.wheeler2@…>

  • Owner set to Daniel Wheeler <daniel.wheeler2@…>
  • Resolution set to fixed
  • Status changed from new to closed

In db6e5992a4ace2160afff3c111f02f437a3a27e9/fipy:

Bug with Matplotliv 1.4.0 is fixed

Fix ticket:672

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.

comment:2 Changed 5 months ago by wd15

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://[email protected]/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(-)

comment:3 Changed 5 months ago by wd15

  • Resolution fixed deleted
  • Status changed from closed to reopened
Note: See TracTickets for help on using tickets.