]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Adding the AUTOFIT_MARGIN along the xaxis when autoFit() is called
authorjh777916 <juba.hamma@cea.fr>
Wed, 20 Sep 2023 12:45:35 +0000 (14:45 +0200)
committerjh777916 <juba.hamma@cea.fr>
Wed, 20 Sep 2023 12:45:35 +0000 (14:45 +0200)
tools/CurvePlot/src/python/views/XYView.py

index d9d15c63037218dfff59543b5fd104e78ba2c056..8542983af7a3903b93338e6407a9243044138e88 100644 (file)
@@ -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()