-# 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
-# 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
-# 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
# 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()
-# 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
-# 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
-# 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
-# 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
-# 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
-# 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
-# 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
-# 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
-# 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
-# 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
-# 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
-# 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
-# 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
-# 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
-# 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
# -*- 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
# -*- 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
-# 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
# -*- 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
# -*- 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
-# 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
-# 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
-# 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
-# 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
-# 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
-# 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
-# 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
-# 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
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()
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
d = self._model.getTable().getData()
# stem returns a StemContainer : (markerline <Line2D>, stemlines<list(Line2D)>, baseline<Line2D> )
- 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()
# 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")
-# 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
-# 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
# 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
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()