From: jh777916 Date: Wed, 20 Sep 2023 12:45:35 +0000 (+0200) Subject: Adding the AUTOFIT_MARGIN along the xaxis when autoFit() is called X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=264ba489a22050101246df89c76243832932b116;p=modules%2Fgui.git Adding the AUTOFIT_MARGIN along the xaxis when autoFit() is called --- diff --git a/tools/CurvePlot/src/python/views/XYView.py b/tools/CurvePlot/src/python/views/XYView.py index d9d15c630..8542983af 100644 --- a/tools/CurvePlot/src/python/views/XYView.py +++ b/tools/CurvePlot/src/python/views/XYView.py @@ -46,7 +46,7 @@ class EventHandler(QObject): return QObject.eventFilter(self, obj, event) class XYView(View): - AUTOFIT_MARGIN = 0.1 # 3% + AUTOFIT_MARGIN = 0.03 # 3% # See http://matplotlib.org/api/markers_api.html: CURVE_MARKERS = [ "o" ,# circle @@ -374,8 +374,10 @@ class XYView(View): xm, xM = self._mplAxes.xaxis.get_data_interval() ym, yM = self._mplAxes.yaxis.get_data_interval() i = yM-ym + j = xM-xm if np.isfinite(xm) and np.isfinite(xM) and np.isfinite(ym) and np.isfinite(yM): - self._mplAxes.axis([xm, xM, ym-i*self.AUTOFIT_MARGIN, yM+i*self.AUTOFIT_MARGIN]) + self._mplAxes.axis([xm-j*self.AUTOFIT_MARGIN, xM+j*self.AUTOFIT_MARGIN, + ym-i*self.AUTOFIT_MARGIN, yM+i*self.AUTOFIT_MARGIN]) if repaint: self.repaint()