]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Bug fix : no auto fit if no curve and avoiding inf ranges
authorabn <adrien.bruneton@cea.fr>
Tue, 15 Jan 2019 14:31:42 +0000 (15:31 +0100)
committerabn <adrien.bruneton@cea.fr>
Wed, 16 Jan 2019 12:42:39 +0000 (13:42 +0100)
tools/CurvePlot/src/python/views/XYView.py

index 3c64d7d78db7e2b8e7a1059f42eddd770f5802eb..b4682ce71281eb7ea9364f8d492be0feb58fdd51 100644 (file)
@@ -270,12 +270,14 @@ class XYView(View):
     pass
 
   def autoFit(self, check=True, repaint=True):
+    import numpy as np
     if self.__repaintOK():
       self._mplAxes.relim()
       xm, xM = self._mplAxes.xaxis.get_data_interval()
       ym, yM = self._mplAxes.yaxis.get_data_interval()
       i = yM-ym
-      self._mplAxes.axis([xm, xM, ym-i*self.AUTOFIT_MARGIN, yM+i*self.AUTOFIT_MARGIN])
+      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])
       if repaint:
         self.repaint()
 
@@ -626,7 +628,8 @@ class XYView(View):
     self.changeFormatAxis()
 
     # Redo auto-fit
-    self.autoFit(repaint=False)
+    if len(self._curveViews):
+      self.autoFit(repaint=False)
     self.repaint()
 
   def onDataChange(self):