From 1db4f8433434af0417011ad49b85327416a53f46 Mon Sep 17 00:00:00 2001 From: Pete Peterson Date: Thu, 21 Nov 2024 10:34:19 -0500 Subject: [PATCH 1/4] Move to matplotlib v3.9 --- conda/recipes/conda_build_config.yaml | 2 +- .../mantidqt/mantidqt/widgets/plotconfigdialog/__init__.py | 2 +- .../widgets/plotconfigdialog/curvestabwidget/__init__.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/conda/recipes/conda_build_config.yaml b/conda/recipes/conda_build_config.yaml index 567c22f601bc..49ddc8254b99 100644 --- a/conda/recipes/conda_build_config.yaml +++ b/conda/recipes/conda_build_config.yaml @@ -66,7 +66,7 @@ numpy: - 2.0.* matplotlib: - - 3.8.* + - 3.9.* mslice: - '2.10' diff --git a/qt/python/mantidqt/mantidqt/widgets/plotconfigdialog/__init__.py b/qt/python/mantidqt/mantidqt/widgets/plotconfigdialog/__init__.py index 387d6bb9294d..1108f02bb03c 100644 --- a/qt/python/mantidqt/mantidqt/widgets/plotconfigdialog/__init__.py +++ b/qt/python/mantidqt/mantidqt/widgets/plotconfigdialog/__init__.py @@ -7,7 +7,7 @@ # This file is part of the mantid workbench. from mantid.plots.utility import row_num, col_num -from matplotlib.axes import ErrorbarContainer +from matplotlib.container import ErrorbarContainer from matplotlib.collections import QuadMesh from mpl_toolkits.mplot3d.art3d import Poly3DCollection diff --git a/qt/python/mantidqt/mantidqt/widgets/plotconfigdialog/curvestabwidget/__init__.py b/qt/python/mantidqt/mantidqt/widgets/plotconfigdialog/curvestabwidget/__init__.py index fe50bf9959e4..6a03cc822d72 100644 --- a/qt/python/mantidqt/mantidqt/widgets/plotconfigdialog/curvestabwidget/__init__.py +++ b/qt/python/mantidqt/mantidqt/widgets/plotconfigdialog/curvestabwidget/__init__.py @@ -7,7 +7,7 @@ # This file is part of the mantid workbench. from matplotlib import rcParams -from matplotlib.axes import ErrorbarContainer +from matplotlib.container import ErrorbarContainer from matplotlib.lines import Line2D from numpy import isclose from qtpy.QtCore import Qt From e512861373c888408116a5fe234385baea8acb34 Mon Sep 17 00:00:00 2001 From: Pete Peterson Date: Mon, 25 Nov 2024 10:41:00 -0500 Subject: [PATCH 2/4] Modify test that bounding box is bigger than the shape The other checks that the 3d view is cubic remain --- .../mantidqt/mantidqt/plotting/test/test_sample_shape.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qt/python/mantidqt/mantidqt/plotting/test/test_sample_shape.py b/qt/python/mantidqt/mantidqt/plotting/test/test_sample_shape.py index 20e735d4469c..7c37722b8604 100644 --- a/qt/python/mantidqt/mantidqt/plotting/test/test_sample_shape.py +++ b/qt/python/mantidqt/mantidqt/plotting/test/test_sample_shape.py @@ -8,7 +8,7 @@ # # -from numpy.testing import assert_array_equal, assert_allclose, assert_almost_equal +from numpy.testing import assert_array_equal, assert_allclose, assert_array_less from os import path, remove from tempfile import gettempdir from unittest import TestCase, main @@ -268,7 +268,7 @@ def test_set_axes_to_largest_mesh(self, mock_call_overall_limits_for_all_meshes) xlim = axes.get_xlim() ylim = axes.get_ylim() zlim = axes.get_zlim() - assert_almost_equal(xlim, (-0.165, 0.165), 5) # extra 5% + assert_array_less((0.15, 0.15), np.abs(xlim)) # window is bigger than object 15cm assert_allclose(xlim, ylim, rtol=self.RELATIVE_TOLERANCE) assert_allclose(xlim, zlim, rtol=self.RELATIVE_TOLERANCE) From db8a9b66bbdf7452dea51bacd8742baeb5955426 Mon Sep 17 00:00:00 2001 From: Ross Whitfield Date: Tue, 26 Nov 2024 12:04:21 +1100 Subject: [PATCH 3/4] Fix IntegratePeaksSkew 'x must be a sequence' Change listed in mpl 3.9 release notes https://matplotlib.org/3.9.0/api/prev_api_changes/api_changes_3.9.0.html#line2d --- .../plugins/algorithms/IntegratePeaksSkew.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Framework/PythonInterface/plugins/algorithms/IntegratePeaksSkew.py b/Framework/PythonInterface/plugins/algorithms/IntegratePeaksSkew.py index 48bdc5c4242b..4a6adfeaa0d4 100644 --- a/Framework/PythonInterface/plugins/algorithms/IntegratePeaksSkew.py +++ b/Framework/PythonInterface/plugins/algorithms/IntegratePeaksSkew.py @@ -651,16 +651,16 @@ def plot_integrated_peak(self, fig, ax, ipk, norm_func): xmask, ymask = np.where(self.peak_mask.T) ax[0].lines[0].set_xdata(xmask) ax[0].lines[0].set_ydata(ymask) - ax[0].lines[1].set_xdata(self.icol) - ax[0].lines[1].set_ydata(self.irow) + ax[0].lines[1].set_xdata([self.icol]) + ax[0].lines[1].set_ydata([self.irow]) img.set_extent([-0.5, self.x_integrated_data.shape[1] - 0.5, self.x_integrated_data.shape[0] - 0.5, -0.5]) # update 1D focused spectrum # vlines xmin_line, xmax_line, data, xpos_line, xmin_init_line, xmax_init_line, y0 = ax[1].lines - xmin_line.set_xdata(self.xmin_opt) - xmax_line.set_xdata(self.xmax_opt) - xmin_init_line.set_xdata(self.xmin) - xmax_init_line.set_xdata(self.xmax) + xmin_line.set_xdata([self.xmin_opt]) + xmax_line.set_xdata([self.xmax_opt]) + xmin_init_line.set_xdata([self.xmin]) + xmax_init_line.set_xdata([self.xmax]) xpos_line.set_xdata([self.xpos]) # spectrum yerr = np.sqrt(self.epk_sq[istart:iend]) From ed04bb69f28786da28619c46aaaa43057204224c Mon Sep 17 00:00:00 2001 From: Pete Peterson Date: Tue, 26 Nov 2024 09:58:02 -0500 Subject: [PATCH 4/4] Update release note to include link for matplotlib 3.9 --- .../v6.12.0/Framework/Dependencies/New_features/38077.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/release/v6.12.0/Framework/Dependencies/New_features/38077.rst b/docs/source/release/v6.12.0/Framework/Dependencies/New_features/38077.rst index 0e63b094dbab..1216a6c2376d 100644 --- a/docs/source/release/v6.12.0/Framework/Dependencies/New_features/38077.rst +++ b/docs/source/release/v6.12.0/Framework/Dependencies/New_features/38077.rst @@ -1 +1 @@ -- Updated Matplotlib from version 3.7 to version 3.8. The release notes for version 3.8 can be found `here `_ . +- Updated Matplotlib from version 3.7 to version 3.9. The release notes for `version 3.8 `_ and `version 3.9 `_