Skip to content

Commit e728a10

Browse files
committed
matplotlib backend: attempt to remove matplotlib warning on conflict between y limits and autoscale
1 parent 1d8c549 commit e728a10

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/silx/gui/plot/backends/BackendMatplotlib.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1193,12 +1193,16 @@ def setLimits(self, xmin, xmax, ymin, ymax, y2min=None, y2max=None):
11931193
self.ax.set_xlim(min(xmin, xmax), max(xmin, xmax))
11941194

11951195
if y2min is not None and y2max is not None:
1196-
if not self.isYAxisInverted():
1196+
if self.ax2.get_autoscaley_on():
1197+
pass
1198+
elif not self.isYAxisInverted():
11971199
self.ax2.set_ylim(min(y2min, y2max), max(y2min, y2max))
11981200
else:
11991201
self.ax2.set_ylim(max(y2min, y2max), min(y2min, y2max))
12001202

1201-
if not self.isYAxisInverted():
1203+
if self.ax.get_autoscaley_on():
1204+
pass
1205+
elif not self.isYAxisInverted():
12021206
self.ax.set_ylim(min(ymin, ymax), max(ymin, ymax))
12031207
else:
12041208
self.ax.set_ylim(max(ymin, ymax), min(ymin, ymax))
@@ -1347,6 +1351,8 @@ def isKeepDataAspectRatio(self):
13471351
def setKeepDataAspectRatio(self, flag):
13481352
self.ax.set_aspect(1.0 if flag else "auto")
13491353
self.ax2.set_aspect(1.0 if flag else "auto")
1354+
# self.ax.set_autoscaley_on(flag)
1355+
# self.ax2.set_autoscaley_on(flag)
13501356

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

0 commit comments

Comments
 (0)