Matplotlib2DViewer and MatplotlibViewer errors

15 views
Skip to first unread message

Fausto Arinos de A. Barbuto

unread,
May 6, 2025, 7:03:44 PM5/6/25
to Fipy

Hi,

Revisiting a few old scripts I realized that they no longer work as they once did.
Apparently, Gmsh2D meshes are not getting along too well with Matplotlib2DViewer 
and MatplotlibViewer. Now I get the following error messages:

ERROR:fipy:Uncaught exception:
Traceback (most recent call last):
  File "C:\Users\faust\Documents\Programs\CFD\FiPy-3.0\Fausto\Canal6.py", line 90, in <module>
    viewer = Matplotlib2DViewer(vars=(C), datamin=Cmin, datamax=Cmax,
  File "C:\Program Files\Python\lib\site-packages\fipy\viewers\matplotlibViewer\matplotlib2DViewer.py", line 49, in __init__
    AbstractMatplotlib2DViewer.__init__(self, vars=vars, title=title, figaspect=figaspect,
  File "C:\Program Files\Python\lib\site-packages\fipy\viewers\matplotlibViewer\abstractMatplotlibViewer.py", line 121, in __init__
    self._colorbar = self.fig.colorbar(mappable=self._mappable,
  File "C:\Program Files\Python\lib\site-packages\matplotlib\figure.py", line 1273, in colorbar
    raise ValueError(
ValueError: Unable to determine Axes to steal space for Colorbar. Either provide the *cax* argument to use as the Axes for the Colorbar, provide the *ax* argument to steal space from it, or add *mappable* to an Axes.

But if I set:

viewer = fipy.Viewer([arguments])

Mayavi (which I don't like a whole lot) opens instead and the expected result is
produced, but I much prefer the old Matplotlib kind of dynamic plot. Another issue
is that a blank Matplotlib plotting window opens too, along with Mayavi, but nothing 
is plotted but the axes. What could that be and how do I fix this?

Windows 11
Python 3.10.11
FiPy 3.4.5
Matplotlib 3.10.1
Mayavi 4.8.3.dev0
VTK 9.4.2

Thanks.

Guyer, Jonathan E. Dr. (Fed)

unread,
May 6, 2025, 7:34:14 PM5/6/25
to FIPY
@cgadal contributed a fix for this, which I just merged to `master` a few days ago.

https://github.com/usnistgov/fipy/pull/1088

________________________________________
From: 'Fausto Arinos de A. Barbuto' via fipy <fi...@list.nist.gov>
Sent: Tuesday, May 6, 2025 19:03
To: FIPY
Subject: [fipy] Matplotlib2DViewer and MatplotlibViewer errors
--
To unsubscribe from this group, send email to fipy+uns...@list.nist.gov

View this message at https://list.nist.gov/fipy
Reply all
Reply to author
Forward
0 new messages