From 264ba489a22050101246df89c76243832932b116 Mon Sep 17 00:00:00 2001 From: jh777916 Date: Wed, 20 Sep 2023 14:45:35 +0200 Subject: [PATCH] Adding the AUTOFIT_MARGIN along the xaxis when autoFit() is called --- tools/CurvePlot/src/python/views/XYView.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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() -- 2.39.2