Repository navigation
Closed
Labels
fix upstreamTo be fixed upstream, or awaiting a fix to be merged upstream; fixing it here is not the solution.visualizationPlotting or other visualizations
Description
Summary
The remapping notebook currently renders a traceback on RTD, likely solver/env drift in HoloViews/Matplotlib stack. The failure happens at display time in the HoloViews matplotlib backend.
Details
holoviews.plotting.mpl.util.fix_aspect is computing NaN for aspect/height so matplotlib rejects the call to set_size_inches().
Potential Solution
Explicitly setting the fig_inches may be more robust here ?
Full traceback
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
File ~/checkouts/readthedocs.org/user_builds/uxarray/conda/latest/lib/python3.14/site-packages/holoviews/core/dimension.py:1491, in Dimensioned._repr_mimebundle_(self, include, exclude)
1484 def _repr_mimebundle_(self, include=None, exclude=None):
1485 """Resolves the class hierarchy for the class rendering the
1486 object using any display hooks registered on Store.display
1487 hooks. The output of all registered display_hooks is then
1488 combined and returned.
1489
1490 """
-> 1491 return Store.render(self)
File ~/checkouts/readthedocs.org/user_builds/uxarray/conda/latest/lib/python3.14/site-packages/holoviews/core/options.py:1517, in Store.render(cls, obj)
1515 data, metadata = {}, {}
1516 for hook in hooks:
-> 1517 ret = hook(obj)
1518 if ret is None:
1519 continue
File ~/checkouts/readthedocs.org/user_builds/uxarray/conda/latest/lib/python3.14/site-packages/holoviews/ipython/display_hooks.py:330, in pprint_display(obj)
328 if not ip.display_formatter.formatters["text/plain"].pprint:
329 return None
--> 330 return display(obj, raw_output=True)
File ~/checkouts/readthedocs.org/user_builds/uxarray/conda/latest/lib/python3.14/site-packages/holoviews/ipython/display_hooks.py:301, in display(obj, raw_output, **kwargs)
299 elif isinstance(obj, (Layout, NdLayout, AdjointLayout)):
300 with option_state(obj):
--> 301 output = layout_display(obj)
302 elif isinstance(obj, (HoloMap, DynamicMap)):
303 with option_state(obj):
File ~/checkouts/readthedocs.org/user_builds/uxarray/conda/latest/lib/python3.14/site-packages/holoviews/ipython/display_hooks.py:193, in display_hook.<locals>.wrapped(element)
191 try:
192 max_frames = OutputSettings.options["max_frames"]
--> 193 mimebundle = fn(element, max_frames=max_frames)
194 if mimebundle is None:
195 return {}, {}
File ~/checkouts/readthedocs.org/user_builds/uxarray/conda/latest/lib/python3.14/site-packages/holoviews/ipython/display_hooks.py:261, in layout_display(layout, max_frames)
258 max_frame_warning(max_frames)
259 return None
--> 261 return render(layout)
File ~/checkouts/readthedocs.org/user_builds/uxarray/conda/latest/lib/python3.14/site-packages/holoviews/ipython/display_hooks.py:62, in render(obj, **kwargs)
59 if renderer.fig == "pdf":
60 renderer = renderer.instance(fig="png")
---> 62 return renderer.components(obj, **kwargs)
File ~/checkouts/readthedocs.org/user_builds/uxarray/conda/latest/lib/python3.14/site-packages/holoviews/plotting/renderer.py:430, in Renderer.components(self, obj, fmt, comm, **kwargs)
428 plot = obj
429 else:
--> 430 plot, fmt = self._validate(obj, fmt)
432 if not isinstance(plot, Viewable):
433 html = self._figure_data(plot, fmt, as_script=True, **kwargs)
File ~/checkouts/readthedocs.org/user_builds/uxarray/conda/latest/lib/python3.14/site-packages/holoviews/plotting/renderer.py:361, in Renderer._validate(self, obj, fmt, **kwargs)
359 plot = HoloViewsPane(obj, center=self.center, backend=self.backend, renderer=self)
360 else:
--> 361 plot = self.get_plot(obj, renderer=self, **kwargs)
363 all_formats = set(fig_formats + holomap_formats)
364 if fmt not in all_formats:
File ~/checkouts/readthedocs.org/user_builds/uxarray/conda/latest/lib/python3.14/site-packages/holoviews/plotting/renderer.py:291, in Renderer.get_plot(self_or_cls, obj, doc, renderer, comm, **kwargs)
287 defaults = [kd.default for kd in plot.dimensions]
288 init_key = tuple(
289 v if d is None else d for v, d in zip(plot.keys[0], defaults, strict=None)
290 )
--> 291 plot.update(init_key)
292 else:
293 plot = obj
File ~/checkouts/readthedocs.org/user_builds/uxarray/conda/latest/lib/python3.14/site-packages/holoviews/plotting/mpl/plot.py:335, in MPLPlot.update(self, key)
333 def update(self, key):
334 if len(self) == 1 and key in (0, self.keys[0]) and not self.drawn:
--> 335 return self.initialize_plot()
336 return self.__getitem__(key)
File ~/checkouts/readthedocs.org/user_builds/uxarray/conda/latest/lib/python3.14/site-packages/holoviews/plotting/mpl/plot.py:64, in mpl_rc_context.<locals>.wrapper(self, *args, **kwargs)
62 def wrapper(self, *args, **kwargs):
63 with _rc_context(self.fig_rcparams):
---> 64 return f(self, *args, **kwargs)
File ~/checkouts/readthedocs.org/user_builds/uxarray/conda/latest/lib/python3.14/site-packages/holoviews/plotting/mpl/plot.py:1283, in LayoutPlot.initialize_plot(self)
1277 traverse_fn = lambda x: x.handles.get("bbox_extra_artists", None)
1278 extra_artists = list(
1279 chain.from_iterable(
1280 artists for artists in self.traverse(traverse_fn) if artists is not None
1281 )
1282 )
-> 1283 fix_aspect(
1284 fig,
1285 self.rows,
1286 self.cols,
1287 title_obj,
1288 extra_artists,
1289 vspace=self.vspace * self.fig_scale,
1290 hspace=self.hspace * self.fig_scale,
1291 )
1292 colorbars = self.traverse(specs=[lambda x: hasattr(x, "colorbar")])
1293 for cbar_plot in colorbars:
File ~/checkouts/readthedocs.org/user_builds/uxarray/conda/latest/lib/python3.14/site-packages/holoviews/plotting/mpl/util.py:288, in fix_aspect(fig, nrows, ncols, title, extra_artists, vspace, hspace)
286 if title and title.get_text():
287 offset = title.get_window_extent().height / fig.dpi
--> 288 fig.set_size_inches(w, (w * aspect) + offset)
290 # Redraw and adjust title position if defined
291 fig.canvas.draw()
File ~/checkouts/readthedocs.org/user_builds/uxarray/conda/latest/lib/python3.14/site-packages/matplotlib/figure.py:3167, in Figure.set_size_inches(self, w, h, forward)
3165 size = np.array([w, h])
3166 if not np.isfinite(size).all() or (size < 0).any():
-> 3167 raise ValueError(f'figure size must be positive finite not {size}')
3168 self.bbox_inches.p1 = size
3169 if forward:
ValueError: figure size must be positive finite not [ 8. nan]
Metadata
Metadata
Assignees
Labels
fix upstreamTo be fixed upstream, or awaiting a fix to be merged upstream; fixing it here is not the solution.visualizationPlotting or other visualizations
Type
Fields
Priority
High
Projects
- StatusShow more project fields✅ Done
Activity
Sevans711 commentedon Jul 2, 2026
Some extra info as I tried to reproduce and debug: I don't see the crash when I try the code with
hv.extension('bokeh'). Additionally, I can reproduce the crash on Python 3.14 and 3.13, but it makes plots just fine on Python 3.10. Maybe this will provide a hint about how to fix? I confirmed holoviews version is the same (holoviews 1.23.0) across my different Python environments.Sevans711 commentedon Jul 6, 2026
A similar error is currently occurring in the MPAS atmosphere cookbook: https://projectpythia.org/unstructured-grid-viz-cookbook/notebooks/recipes/mpas-atmo/
Pasting that traceback below for future reference:
Sevans711 commentedon Jul 6, 2026
A probably-similar bug is affecting the "Reading Structured Grids" page: https://uxarray.readthedocs.io/en/latest/user-guide/structured.html
There's no crash message, but the plot looks similar to what I was seeing when trying to reproduce the issue from the remapping page using a single plot instead of a Layout with 2 plots in a column. The plot is hidden except for a sliver on the right, and also the colorbar is visible.
Sevans711 commentedon Jul 6, 2026
There is also a similar crash in the "Constructing a Grid from Points" page: https://uxarray.readthedocs.io/en/latest/user-guide/from-points.html
The traceback is similar to what I copy-pasted in prior message, but ends with
ValueError: figure size must be positive finite not [12. nan]instead. (This one is supposed to be a layout with 3 plots; I am noticing the error message follows the pattern [4 * number of plots, nan])I think this last one concludes the list of uxarray documentation pages / cookbooks which are being affected by this bug; I just finished looking through most (all?) docs and cookbooks. Next step is to debug, then check if the solution actually fixes all of these examples.
Sevans711 commentedon Jul 8, 2026
Progress update: I believe I've narrowed it down to the latest matplotlib update, 3.11.0. When I downgrade to the latest pre-3.11 version, matplotlib 3.10.9, I don't get the crash, I instead get nice plots.
If we need a very quick fix, we could change dependencies to require matplotlib<3.11 for now. In the meantime, I'll see if I can find a fix when still using matplotlib 3.11.
Summary:
Sevans711 commentedon Jul 8, 2026
This looks like an upstream issue; I was able to reproduce it without using UXarray at all. See holoviz/geoviews#850 for more details!
Downgrade to matplotlib<3.11 to fix RTD plots
regression test for #1542
5 remaining items
rajeeja commentedon Aug 24, 2026
Thanks for this detailed issue and potential fix. I'll look into this.
Drop matplotlib<3.11, require cartopy>=0.26
Drop matplotlib<3.11, require cartopy>=0.26
Drop unjustified cartopy floor from [geo] extra