Skip to content

Commit

Permalink
matplotlib backend: attempt to remove matplotlib warning on conflict …
Browse files Browse the repository at this point in the history
…between y limits and autoscale
  • Loading branch information
payno committed Jan 21, 2025
1 parent 1d8c549 commit e728a10
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/silx/gui/plot/backends/BackendMatplotlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -1193,12 +1193,16 @@ def setLimits(self, xmin, xmax, ymin, ymax, y2min=None, y2max=None):
self.ax.set_xlim(min(xmin, xmax), max(xmin, xmax))

if y2min is not None and y2max is not None:
if not self.isYAxisInverted():
if self.ax2.get_autoscaley_on():
pass
elif not self.isYAxisInverted():
self.ax2.set_ylim(min(y2min, y2max), max(y2min, y2max))
else:
self.ax2.set_ylim(max(y2min, y2max), min(y2min, y2max))

if not self.isYAxisInverted():
if self.ax.get_autoscaley_on():
pass
elif not self.isYAxisInverted():
self.ax.set_ylim(min(ymin, ymax), max(ymin, ymax))
else:
self.ax.set_ylim(max(ymin, ymax), min(ymin, ymax))
Expand Down Expand Up @@ -1347,6 +1351,8 @@ def isKeepDataAspectRatio(self):
def setKeepDataAspectRatio(self, flag):
self.ax.set_aspect(1.0 if flag else "auto")
self.ax2.set_aspect(1.0 if flag else "auto")
# self.ax.set_autoscaley_on(flag)
# self.ax2.set_autoscaley_on(flag)

def setGraphGrid(self, which):
self.ax.grid(False, which="both") # Disable all grid first
Expand Down

0 comments on commit e728a10

Please sign in to comment.