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