From 48764acb719cb21ec6c48bf6653fbe36ff9b978e Mon Sep 17 00:00:00 2001 From: Sam Evans Date: Wed, 8 Jul 2026 18:11:32 -0400 Subject: [PATCH 1/3] Downgrade to matplotlib<3.11 to fix RTD plots readthedocs plots are breaking on matplotlib 3.11 but not matplotlib<3.11. This is a workaround for issue #1542 until things get fixed upstream. --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 119c2bb0d..3ee69940c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -27,7 +27,7 @@ dependencies = [ "datashader", "geoviews", "holoviews", - "matplotlib", + "matplotlib<3.11", # matplotlib 3.11.0 breaks some plots but <3.11 is fine; see issue #1542. "matplotlib-inline", "netcdf4", "numba", From e7297ebed70f928b3c450beaf8aebd61b8482e88 Mon Sep 17 00:00:00 2001 From: Sam Evans Date: Wed, 8 Jul 2026 18:40:41 -0400 Subject: [PATCH 2/3] regression test for #1542 I checked, this test currently crashes on matplotlib 3.11, but not on matplotlib 3.10.9. --- test/test_plot.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/test/test_plot.py b/test/test_plot.py index eb7cdcb8f..f6912e6bb 100644 --- a/test/test_plot.py +++ b/test/test_plot.py @@ -229,3 +229,19 @@ def test_to_raster_pixel_ratio(gridpath, r1, r2): f = r2 / r1 d = np.array(raster2.shape) - f * np.array(raster1.shape) assert (d >= 0).all() and (d <= f - 1).all() + +def test_plot_with_features(gridpath, datasetpath): + """ensure can render a multiplot layout with geoviews features. + Regression test for issue #1542. + """ + gridpath = gridpath("ugrid", "geoflow-small", "grid.nc") + uxds1 = ux.open_dataset(gridpath, datasetpath("ugrid", "geoflow-small", "v1.nc")) + uxds2 = ux.open_dataset(gridpath, datasetpath("ugrid", "geoflow-small", "v2.nc")) + uxds1 = uxds1.isel(time=0, meshLayers=0) # plot currently expects 1D along n_node + uxds2 = uxds2.isel(time=0, meshLayers=0) + plot1 = uxds1["v1"].plot(features=['coastline']) + plot2 = uxds2["v2"].plot(features=['coastline']) + plot = plot1 + plot2 + # the crash associated with issue #1542 only occurs when actually trying to render: + renderer = hv.renderer("matplotlib") # or "matplotlib" + renderer.get_plot(plot) From 4b0a7529c62b75e9be1202efb7c87144e4c3f7f7 Mon Sep 17 00:00:00 2001 From: Sam Evans Date: Thu, 9 Jul 2026 10:45:48 -0400 Subject: [PATCH 3/3] fix: need mpl<3.11 pin in .yml files too also remove a confusing comment in test_plot.py --- ci/asv.yml | 2 +- ci/docs.yml | 2 +- ci/environment.yml | 2 +- test/test_plot.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ci/asv.yml b/ci/asv.yml index 16550e8e9..7062c7e33 100644 --- a/ci/asv.yml +++ b/ci/asv.yml @@ -8,7 +8,7 @@ dependencies: - datashader - geoviews - holoviews - - matplotlib-base + - matplotlib-base<3.11 # 3.11.0 breaks some plots but <3.11 is fine; see issue #1542. - matplotlib-inline - healpix - netcdf4 diff --git a/ci/docs.yml b/ci/docs.yml index ff0c3e945..07172c0d2 100644 --- a/ci/docs.yml +++ b/ci/docs.yml @@ -28,7 +28,7 @@ dependencies: - myst-nb - sphinx-design - nbsphinx - - matplotlib-base + - matplotlib-base<3.11 # 3.11.0 breaks some plots but <3.11 is fine; see issue #1542. - matplotlib-inline - shapely - hvplot diff --git a/ci/environment.yml b/ci/environment.yml index 02f4616d9..2049e965e 100644 --- a/ci/environment.yml +++ b/ci/environment.yml @@ -14,7 +14,7 @@ dependencies: - holoviews - hvplot - hypothesis - - matplotlib-base + - matplotlib-base<3.11 # 3.11.0 breaks some plots but <3.11 is fine; see issue #1542. - matplotlib-inline - netcdf4 - numba diff --git a/test/test_plot.py b/test/test_plot.py index f6912e6bb..ae245b392 100644 --- a/test/test_plot.py +++ b/test/test_plot.py @@ -243,5 +243,5 @@ def test_plot_with_features(gridpath, datasetpath): plot2 = uxds2["v2"].plot(features=['coastline']) plot = plot1 + plot2 # the crash associated with issue #1542 only occurs when actually trying to render: - renderer = hv.renderer("matplotlib") # or "matplotlib" + renderer = hv.renderer("matplotlib") renderer.get_plot(plot)