# 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()