From e1adfa63af692400657ff4c17dc76b6ef5c775fd Mon Sep 17 00:00:00 2001 From: jh777916 Date: Wed, 11 Sep 2024 16:04:21 +0200 Subject: [PATCH] fix : propagating the modifications induced by the matplotlib version upgrade from v3.0.3 to 3.1.0; see more ... More details in commits b54e417f60, 2b7810b19e, 26e4ea9412 (branch jha/CurvePlot_barplot_stemplot_9_12_0) --- tools/CurvePlot/src/python/CMakeLists.txt | 2 +- .../src/python/controller/CMakeLists.txt | 2 +- .../src/python/controller/PlotController.py | 4 ++-- .../CurvePlot/src/python/controller/__init__.py | 2 +- .../CurvePlot/src/python/controller/utils.py.in | 2 +- tools/CurvePlot/src/python/model/CMakeLists.txt | 2 +- tools/CurvePlot/src/python/model/CurveModel.py | 2 +- tools/CurvePlot/src/python/model/Model.py | 2 +- tools/CurvePlot/src/python/model/PlotManager.py | 2 +- tools/CurvePlot/src/python/model/TableModel.py | 2 +- .../src/python/model/XYPlotSetModel.py | 2 +- .../src/python/pyqtside/CMakeLists.txt | 2 +- tools/CurvePlot/src/python/pyqtside/QtCore.py | 2 +- tools/CurvePlot/src/python/pyqtside/QtGui.py | 2 +- .../CurvePlot/src/python/pyqtside/QtWidgets.py | 2 +- tools/CurvePlot/src/python/pyqtside/__init__.py | 2 +- tools/CurvePlot/src/python/pyqtside/uic.py | 2 +- tools/CurvePlot/src/python/test/CMakeLists.txt | 2 +- .../src/python/test/PlotCurve_Standalone.py | 2 +- tools/CurvePlot/src/python/test/PlotTestBase.py | 2 +- .../src/python/test/SalomePyQt_MockUp.py.in | 2 +- tools/CurvePlot/src/python/test/TestDesktop.py | 2 +- tools/CurvePlot/src/python/test/plot_test.py | 2 +- tools/CurvePlot/src/python/ui/CMakeLists.txt | 2 +- .../src/python/ui/CurveTreeDockWidget.py | 2 +- tools/CurvePlot/src/python/ui/PlotSettings.py | 2 +- tools/CurvePlot/src/python/ui/PlotWidget.py | 2 +- tools/CurvePlot/src/python/views/CMakeLists.txt | 2 +- .../src/python/views/CurveBrowserView.py | 2 +- .../CurvePlot/src/python/views/CurveTabsView.py | 2 +- tools/CurvePlot/src/python/views/CurveView.py | 5 +++-- tools/CurvePlot/src/python/views/StemView.py | 17 ++++++++++++++--- tools/CurvePlot/src/python/views/View.py | 2 +- tools/CurvePlot/src/python/views/XYView.py | 14 ++++++++++++-- 34 files changed, 61 insertions(+), 39 deletions(-) diff --git a/tools/CurvePlot/src/python/CMakeLists.txt b/tools/CurvePlot/src/python/CMakeLists.txt index 0452be71f..552c806d6 100644 --- a/tools/CurvePlot/src/python/CMakeLists.txt +++ b/tools/CurvePlot/src/python/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2012-2022 CEA/DEN, EDF R&D +# Copyright (C) 2012-2023 CEA, EDF # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public diff --git a/tools/CurvePlot/src/python/controller/CMakeLists.txt b/tools/CurvePlot/src/python/controller/CMakeLists.txt index d91a29705..1dcb36252 100644 --- a/tools/CurvePlot/src/python/controller/CMakeLists.txt +++ b/tools/CurvePlot/src/python/controller/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2012-2022 CEA/DEN, EDF R&D +# Copyright (C) 2012-2023 CEA, EDF # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public diff --git a/tools/CurvePlot/src/python/controller/PlotController.py b/tools/CurvePlot/src/python/controller/PlotController.py index c2a619fd7..9bb3bf2f6 100644 --- a/tools/CurvePlot/src/python/controller/PlotController.py +++ b/tools/CurvePlot/src/python/controller/PlotController.py @@ -1,4 +1,4 @@ -# Copyright (C) 2016-2022 CEA/DEN, EDF R&D +# Copyright (C) 2016-2023 CEA, EDF # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -926,4 +926,4 @@ class PlotController(object): # Upon change on the curve also update the full plot, notably for the auto-fit and the legend: self.setModelListener(sm, xyview) - return sm.getID(),cps.getID() \ No newline at end of file + return sm.getID(),cps.getID() diff --git a/tools/CurvePlot/src/python/controller/__init__.py b/tools/CurvePlot/src/python/controller/__init__.py index 8269a5e03..a18d661dc 100644 --- a/tools/CurvePlot/src/python/controller/__init__.py +++ b/tools/CurvePlot/src/python/controller/__init__.py @@ -1,4 +1,4 @@ -# Copyright (C) 2016-2022 CEA/DEN, EDF R&D +# Copyright (C) 2016-2023 CEA, EDF # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public diff --git a/tools/CurvePlot/src/python/controller/utils.py.in b/tools/CurvePlot/src/python/controller/utils.py.in index 5b85b40f3..3bcdaeca1 100644 --- a/tools/CurvePlot/src/python/controller/utils.py.in +++ b/tools/CurvePlot/src/python/controller/utils.py.in @@ -1,4 +1,4 @@ -# Copyright (C) 2016-2022 CEA/DEN, EDF R&D +# Copyright (C) 2016-2023 CEA, EDF # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public diff --git a/tools/CurvePlot/src/python/model/CMakeLists.txt b/tools/CurvePlot/src/python/model/CMakeLists.txt index b756d9156..7339e535f 100644 --- a/tools/CurvePlot/src/python/model/CMakeLists.txt +++ b/tools/CurvePlot/src/python/model/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2012-2022 CEA/DEN, EDF R&D +# Copyright (C) 2012-2023 CEA, EDF # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public diff --git a/tools/CurvePlot/src/python/model/CurveModel.py b/tools/CurvePlot/src/python/model/CurveModel.py index c8d7c6426..218f80d8e 100644 --- a/tools/CurvePlot/src/python/model/CurveModel.py +++ b/tools/CurvePlot/src/python/model/CurveModel.py @@ -1,4 +1,4 @@ -# Copyright (C) 2016-2022 CEA/DEN, EDF R&D +# Copyright (C) 2016-2023 CEA, EDF # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public diff --git a/tools/CurvePlot/src/python/model/Model.py b/tools/CurvePlot/src/python/model/Model.py index e77132f10..6f3253225 100644 --- a/tools/CurvePlot/src/python/model/Model.py +++ b/tools/CurvePlot/src/python/model/Model.py @@ -1,4 +1,4 @@ -# Copyright (C) 2016-2022 CEA/DEN, EDF R&D +# Copyright (C) 2016-2023 CEA, EDF # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public diff --git a/tools/CurvePlot/src/python/model/PlotManager.py b/tools/CurvePlot/src/python/model/PlotManager.py index eca716800..504ad6b3d 100644 --- a/tools/CurvePlot/src/python/model/PlotManager.py +++ b/tools/CurvePlot/src/python/model/PlotManager.py @@ -1,4 +1,4 @@ -# Copyright (C) 2016-2022 CEA/DEN, EDF R&D +# Copyright (C) 2016-2023 CEA, EDF # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public diff --git a/tools/CurvePlot/src/python/model/TableModel.py b/tools/CurvePlot/src/python/model/TableModel.py index 78e3c2443..7ead44be7 100644 --- a/tools/CurvePlot/src/python/model/TableModel.py +++ b/tools/CurvePlot/src/python/model/TableModel.py @@ -1,4 +1,4 @@ -# Copyright (C) 2016-2022 CEA/DEN, EDF R&D +# Copyright (C) 2016-2023 CEA, EDF # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public diff --git a/tools/CurvePlot/src/python/model/XYPlotSetModel.py b/tools/CurvePlot/src/python/model/XYPlotSetModel.py index 93bd7beda..dd368f84f 100644 --- a/tools/CurvePlot/src/python/model/XYPlotSetModel.py +++ b/tools/CurvePlot/src/python/model/XYPlotSetModel.py @@ -1,4 +1,4 @@ -# Copyright (C) 2016-2022 CEA/DEN, EDF R&D +# Copyright (C) 2016-2023 CEA, EDF # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public diff --git a/tools/CurvePlot/src/python/pyqtside/CMakeLists.txt b/tools/CurvePlot/src/python/pyqtside/CMakeLists.txt index ce77a2a1a..e50bb31d5 100644 --- a/tools/CurvePlot/src/python/pyqtside/CMakeLists.txt +++ b/tools/CurvePlot/src/python/pyqtside/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2012-2022 CEA/DEN, EDF R&D +# Copyright (C) 2012-2023 CEA, EDF # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public diff --git a/tools/CurvePlot/src/python/pyqtside/QtCore.py b/tools/CurvePlot/src/python/pyqtside/QtCore.py index 18600c6c6..95d483087 100644 --- a/tools/CurvePlot/src/python/pyqtside/QtCore.py +++ b/tools/CurvePlot/src/python/pyqtside/QtCore.py @@ -1,4 +1,4 @@ -# Copyright (C) 2016-2022 CEA/DEN, EDF R&D +# Copyright (C) 2016-2023 CEA, EDF # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public diff --git a/tools/CurvePlot/src/python/pyqtside/QtGui.py b/tools/CurvePlot/src/python/pyqtside/QtGui.py index 80d04433d..b5ce0b7a0 100644 --- a/tools/CurvePlot/src/python/pyqtside/QtGui.py +++ b/tools/CurvePlot/src/python/pyqtside/QtGui.py @@ -1,4 +1,4 @@ -# Copyright (C) 2016-2022 CEA/DEN, EDF R&D +# Copyright (C) 2016-2023 CEA, EDF # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public diff --git a/tools/CurvePlot/src/python/pyqtside/QtWidgets.py b/tools/CurvePlot/src/python/pyqtside/QtWidgets.py index 8f67f6b92..fd9510ba3 100644 --- a/tools/CurvePlot/src/python/pyqtside/QtWidgets.py +++ b/tools/CurvePlot/src/python/pyqtside/QtWidgets.py @@ -1,4 +1,4 @@ -# Copyright (C) 2016-2022 CEA/DEN, EDF R&D +# Copyright (C) 2016-2023 CEA, EDF # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public diff --git a/tools/CurvePlot/src/python/pyqtside/__init__.py b/tools/CurvePlot/src/python/pyqtside/__init__.py index 8afde8c5f..513f41d08 100644 --- a/tools/CurvePlot/src/python/pyqtside/__init__.py +++ b/tools/CurvePlot/src/python/pyqtside/__init__.py @@ -1,4 +1,4 @@ -# Copyright (C) 2016-2022 CEA/DEN, EDF R&D +# Copyright (C) 2016-2023 CEA, EDF # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public diff --git a/tools/CurvePlot/src/python/pyqtside/uic.py b/tools/CurvePlot/src/python/pyqtside/uic.py index 94043c6c8..689abfd41 100644 --- a/tools/CurvePlot/src/python/pyqtside/uic.py +++ b/tools/CurvePlot/src/python/pyqtside/uic.py @@ -1,4 +1,4 @@ -# Copyright (C) 2016-2022 CEA/DEN, EDF R&D +# Copyright (C) 2016-2023 CEA, EDF # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public diff --git a/tools/CurvePlot/src/python/test/CMakeLists.txt b/tools/CurvePlot/src/python/test/CMakeLists.txt index a001435d4..a7799f742 100644 --- a/tools/CurvePlot/src/python/test/CMakeLists.txt +++ b/tools/CurvePlot/src/python/test/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2012-2022 CEA/DEN, EDF R&D +# Copyright (C) 2012-2023 CEA, EDF # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public diff --git a/tools/CurvePlot/src/python/test/PlotCurve_Standalone.py b/tools/CurvePlot/src/python/test/PlotCurve_Standalone.py index 73c8221a1..deafd678b 100755 --- a/tools/CurvePlot/src/python/test/PlotCurve_Standalone.py +++ b/tools/CurvePlot/src/python/test/PlotCurve_Standalone.py @@ -1,5 +1,5 @@ # -*- coding: latin-1 -*- -# Copyright (C) 2007-2022 CEA/DEN, EDF R&D +# Copyright (C) 2007-2023 CEA, EDF # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public diff --git a/tools/CurvePlot/src/python/test/PlotTestBase.py b/tools/CurvePlot/src/python/test/PlotTestBase.py index 1e254e3a0..0cd71ee31 100644 --- a/tools/CurvePlot/src/python/test/PlotTestBase.py +++ b/tools/CurvePlot/src/python/test/PlotTestBase.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright (C) 2007-2022 CEA/DEN, EDF R&D +# Copyright (C) 2007-2023 CEA, EDF # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public diff --git a/tools/CurvePlot/src/python/test/SalomePyQt_MockUp.py.in b/tools/CurvePlot/src/python/test/SalomePyQt_MockUp.py.in index 9c4bbbc4e..8de76f93c 100644 --- a/tools/CurvePlot/src/python/test/SalomePyQt_MockUp.py.in +++ b/tools/CurvePlot/src/python/test/SalomePyQt_MockUp.py.in @@ -1,4 +1,4 @@ -# Copyright (C) 2007-2022 CEA/DEN, EDF R&D +# Copyright (C) 2007-2023 CEA, EDF # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public diff --git a/tools/CurvePlot/src/python/test/TestDesktop.py b/tools/CurvePlot/src/python/test/TestDesktop.py index ba66bf44e..ae6d15c6b 100644 --- a/tools/CurvePlot/src/python/test/TestDesktop.py +++ b/tools/CurvePlot/src/python/test/TestDesktop.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright (C) 2007-2022 CEA/DEN, EDF R&D +# Copyright (C) 2007-2023 CEA, EDF # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public diff --git a/tools/CurvePlot/src/python/test/plot_test.py b/tools/CurvePlot/src/python/test/plot_test.py index 8240dd9d0..29ea32681 100644 --- a/tools/CurvePlot/src/python/test/plot_test.py +++ b/tools/CurvePlot/src/python/test/plot_test.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright (C) 2007-2022 CEA/DEN, EDF R&D +# Copyright (C) 2007-2023 CEA, EDF # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public diff --git a/tools/CurvePlot/src/python/ui/CMakeLists.txt b/tools/CurvePlot/src/python/ui/CMakeLists.txt index 1702ea090..68d41ff10 100644 --- a/tools/CurvePlot/src/python/ui/CMakeLists.txt +++ b/tools/CurvePlot/src/python/ui/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2012-2022 CEA/DEN, EDF R&D +# Copyright (C) 2012-2023 CEA, EDF # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public diff --git a/tools/CurvePlot/src/python/ui/CurveTreeDockWidget.py b/tools/CurvePlot/src/python/ui/CurveTreeDockWidget.py index 636603cc6..5b07bb6d6 100644 --- a/tools/CurvePlot/src/python/ui/CurveTreeDockWidget.py +++ b/tools/CurvePlot/src/python/ui/CurveTreeDockWidget.py @@ -1,4 +1,4 @@ -# Copyright (C) 2016-2022 CEA/DEN, EDF R&D +# Copyright (C) 2016-2023 CEA, EDF # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public diff --git a/tools/CurvePlot/src/python/ui/PlotSettings.py b/tools/CurvePlot/src/python/ui/PlotSettings.py index 6020d41a5..12121ca09 100644 --- a/tools/CurvePlot/src/python/ui/PlotSettings.py +++ b/tools/CurvePlot/src/python/ui/PlotSettings.py @@ -1,4 +1,4 @@ -# Copyright (C) 2016-2022 CEA/DEN, EDF R&D +# Copyright (C) 2016-2023 CEA, EDF # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public diff --git a/tools/CurvePlot/src/python/ui/PlotWidget.py b/tools/CurvePlot/src/python/ui/PlotWidget.py index fd5c29fe9..c10ed8930 100644 --- a/tools/CurvePlot/src/python/ui/PlotWidget.py +++ b/tools/CurvePlot/src/python/ui/PlotWidget.py @@ -1,4 +1,4 @@ -# Copyright (C) 2016-2022 CEA/DEN, EDF R&D +# Copyright (C) 2016-2023 CEA, EDF # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public diff --git a/tools/CurvePlot/src/python/views/CMakeLists.txt b/tools/CurvePlot/src/python/views/CMakeLists.txt index 316a1d517..f47db43c1 100644 --- a/tools/CurvePlot/src/python/views/CMakeLists.txt +++ b/tools/CurvePlot/src/python/views/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2012-2022 CEA/DEN, EDF R&D +# Copyright (C) 2012-2023 CEA, EDF # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public diff --git a/tools/CurvePlot/src/python/views/CurveBrowserView.py b/tools/CurvePlot/src/python/views/CurveBrowserView.py index 9940aa6aa..560bbe283 100644 --- a/tools/CurvePlot/src/python/views/CurveBrowserView.py +++ b/tools/CurvePlot/src/python/views/CurveBrowserView.py @@ -1,4 +1,4 @@ -# Copyright (C) 2016-2022 CEA/DEN, EDF R&D +# Copyright (C) 2016-2023 CEA, EDF # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public diff --git a/tools/CurvePlot/src/python/views/CurveTabsView.py b/tools/CurvePlot/src/python/views/CurveTabsView.py index c6a52b2ce..001bafe14 100644 --- a/tools/CurvePlot/src/python/views/CurveTabsView.py +++ b/tools/CurvePlot/src/python/views/CurveTabsView.py @@ -1,4 +1,4 @@ -# Copyright (C) 2016-2022 CEA/DEN, EDF R&D +# Copyright (C) 2016-2023 CEA, EDF # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public diff --git a/tools/CurvePlot/src/python/views/CurveView.py b/tools/CurvePlot/src/python/views/CurveView.py index dafc9eb87..0c1a55270 100644 --- a/tools/CurvePlot/src/python/views/CurveView.py +++ b/tools/CurvePlot/src/python/views/CurveView.py @@ -1,4 +1,4 @@ -# Copyright (C) 2016-2022 CEA/DEN, EDF R&D +# Copyright (C) 2016-2023 CEA, EDF # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -38,8 +38,9 @@ class CurveView(PlotView): x_idx, y_idx = m.getXAxisIndex(), m.getYAxisIndex() d = self._model.getTable().getData() plots = self._mplAxes.plot(d[:, x_idx], d[:, y_idx], label=m._title, alpha = 1., - picker=self._PICKER_PRECISION) + picker=True) self._mplArtist = plots[0] + self._mplArtist.set_pickradius(self._PICKER_PRECISION) self._initialLineWidth = self._mplArtist.get_linewidth() self._initialOpacity = self._mplArtist.get_alpha() self._initialZOrder = self._mplArtist.get_zorder() diff --git a/tools/CurvePlot/src/python/views/StemView.py b/tools/CurvePlot/src/python/views/StemView.py index dd721b515..556baac90 100644 --- a/tools/CurvePlot/src/python/views/StemView.py +++ b/tools/CurvePlot/src/python/views/StemView.py @@ -19,6 +19,11 @@ from .PlotView import PlotView from .utils import Logger +# Matplotlib stem() function evolved from 3.0.3 to 3.1.0 : update of the returned StemContainer +# The old implementation of StemView class is kept to ensure backwards compatibility +# with Salome 9.9.0, which uses matplotlib v3.0.3 +import matplotlib +from packaging import version class StemView(PlotView): _PICKER_PRECISION = 10 #pts @@ -32,8 +37,13 @@ class StemView(PlotView): d = self._model.getTable().getData() # stem returns a StemContainer : (markerline , stemlines, baseline ) - self._mplArtist = self._mplAxes.stem(d[:, x_idx], d[:, y_idx], label=m._title,\ - linefmt='b-', markerfmt='_', basefmt=' ') + if version.parse(matplotlib.__version__) < version.parse("3.1.0"): + self._mplArtist = self._mplAxes.stem(d[:, x_idx], d[:, y_idx], label=m._title,\ + linefmt='b-', markerfmt='_', basefmt=' ') + else: + self._mplArtist = self._mplAxes.stem(d[:, x_idx], d[:, y_idx], label=m._title,\ + linefmt='b-', markerfmt='_', basefmt=' ', + use_line_collection=False) self._initialLineWidth = self._mplArtist[0].get_linewidth() self._initialZOrder = self._mplArtist[0].get_zorder() @@ -46,7 +56,8 @@ class StemView(PlotView): # picker for the stemlines for lin in self._mplArtist[1]: - lin.set_picker(self._PICKER_PRECISION) + lin.set_picker(True) + lin.set_pickradius(self._PICKER_PRECISION) def update(self): Logger.Debug("StemView::udpate") diff --git a/tools/CurvePlot/src/python/views/View.py b/tools/CurvePlot/src/python/views/View.py index ea079a3cd..e74a9d29d 100644 --- a/tools/CurvePlot/src/python/views/View.py +++ b/tools/CurvePlot/src/python/views/View.py @@ -1,4 +1,4 @@ -# Copyright (C) 2016-2022 CEA/DEN, EDF R&D +# Copyright (C) 2016-2023 CEA, EDF # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public diff --git a/tools/CurvePlot/src/python/views/XYView.py b/tools/CurvePlot/src/python/views/XYView.py index bb8083192..773e655e2 100644 --- a/tools/CurvePlot/src/python/views/XYView.py +++ b/tools/CurvePlot/src/python/views/XYView.py @@ -1,4 +1,4 @@ -# Copyright (C) 2016-2022 CEA/DEN, EDF R&D +# Copyright (C) 2016-2023 CEA, EDF # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -17,6 +17,12 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # +# Matplotlib xaxis._gridOnMajor is deprecated since matplotlib v3.3.0 +# The old implementation of XYView class is kept to ensure backwards compatibility +# with Salome 9.9.0, which uses matplotlib v3.0.3 +import matplotlib +from packaging import version + import matplotlib.pyplot as plt import matplotlib.colors as colors from matplotlib.patches import Rectangle @@ -610,7 +616,11 @@ class XYView(View): dlg.titleEdit.setText(self._mplAxes.get_title()) dlg.axisXTitleEdit.setText(self._mplAxes.get_xlabel()) dlg.axisYTitleEdit.setText(self._mplAxes.get_ylabel()) - dlg.gridCheckBox.setChecked(self._mplAxes.xaxis._gridOnMajor) # could not find a relevant API to check this + # could not find a relevant API to check this + if version.parse(matplotlib.__version__) < version.parse("3.3.0"): + dlg.gridCheckBox.setChecked(self._mplAxes.xaxis._gridOnMajor) + else : + dlg.gridCheckBox.setChecked(self._mplAxes.xaxis._major_tick_kw['gridOn']) dlg.axisXSciCheckBox.setChecked(self._axisXSciNotation) dlg.axisYSciCheckBox.setChecked(self._axisYSciNotation) xmin, xmax = self._mplAxes.get_xlim() -- 2.39.2