|
1 | 1 | # /*##########################################################################
|
2 | 2 | #
|
3 |
| -# Copyright (c) 2004-2023 European Synchrotron Radiation Facility |
| 3 | +# Copyright (c) 2004-2025 European Synchrotron Radiation Facility |
4 | 4 | #
|
5 | 5 | # Permission is hereby granted, free of charge, to any person obtaining a copy
|
6 | 6 | # of this software and associated documentation files (the "Software"), to deal
|
@@ -552,7 +552,8 @@ def __init__(self, plot, parent=None):
|
552 | 552 | for axis in (self.ax.yaxis, self.ax.xaxis, self.ax2.yaxis, self.ax2.xaxis):
|
553 | 553 | axis.set_major_formatter(DefaultTickFormatter())
|
554 | 554 |
|
555 |
| - self.ax2.set_autoscaley_on(True) |
| 555 | + self.ax.set_autoscaley_on(False) |
| 556 | + self.ax2.set_autoscaley_on(False) |
556 | 557 |
|
557 | 558 | # this works but the figure color is left
|
558 | 559 | if self._matplotlibVersion < Version("2"):
|
@@ -1192,17 +1193,10 @@ def setLimits(self, xmin, xmax, ymin, ymax, y2min=None, y2max=None):
|
1192 | 1193 | self._dirtyLimits = True
|
1193 | 1194 | self.ax.set_xlim(min(xmin, xmax), max(xmin, xmax))
|
1194 | 1195 |
|
1195 |
| - keepRatio = self.isKeepDataAspectRatio() |
1196 | 1196 | if y2min is not None and y2max is not None:
|
1197 |
| - if not self.isYAxisInverted(): |
1198 |
| - self.ax2.set_ylim(min(y2min, y2max), max(y2min, y2max), auto=keepRatio) |
1199 |
| - else: |
1200 |
| - self.ax2.set_ylim(max(y2min, y2max), min(y2min, y2max), auto=keepRatio) |
| 1197 | + self.ax2.set_ybound(min(y2min, y2max), max(y2min, y2max)) |
1201 | 1198 |
|
1202 |
| - if not self.isYAxisInverted(): |
1203 |
| - self.ax.set_ylim(min(ymin, ymax), max(ymin, ymax), auto=keepRatio) |
1204 |
| - else: |
1205 |
| - self.ax.set_ylim(max(ymin, ymax), min(ymin, ymax), auto=keepRatio) |
| 1199 | + self.ax.set_ybound(min(ymin, ymax), max(ymin, ymax)) |
1206 | 1200 |
|
1207 | 1201 | self._updateMarkers()
|
1208 | 1202 |
|
@@ -1251,11 +1245,7 @@ def setGraphYLimits(self, ymin, ymax, axis):
|
1251 | 1245 | xcenter = 0.5 * (xmin + xmax)
|
1252 | 1246 | ax.set_xlim(xcenter - 0.5 * newXRange, xcenter + 0.5 * newXRange)
|
1253 | 1247 |
|
1254 |
| - keepRatio = self.isKeepDataAspectRatio() |
1255 |
| - if not self.isYAxisInverted(): |
1256 |
| - ax.set_ylim(ymin, ymax, auto=keepRatio) |
1257 |
| - else: |
1258 |
| - ax.set_ylim(ymax, ymin, auto=keepRatio) |
| 1248 | + ax.set_ybound(ymin, ymax) |
1259 | 1249 |
|
1260 | 1250 | self._updateMarkers()
|
1261 | 1251 |
|
@@ -1317,7 +1307,7 @@ def setYAxisLogarithmic(self, flag):
|
1317 | 1307 | dataRange = self._plot.getDataRange()[dataRangeIndex]
|
1318 | 1308 | if dataRange is None:
|
1319 | 1309 | dataRange = 1, 100 # Fallback
|
1320 |
| - axis.set_ylim(*dataRange, auto=self.isKeepDataAspectRatio()) |
| 1310 | + axis.set_ybound(*dataRange) |
1321 | 1311 | redraw = True
|
1322 | 1312 | if redraw:
|
1323 | 1313 | self.draw()
|
@@ -1623,6 +1613,8 @@ def resizeEvent(self, event):
|
1623 | 1613 | self.ax.get_ybound(),
|
1624 | 1614 | self.ax2.get_ybound(),
|
1625 | 1615 | )
|
| 1616 | + self.ax.set_autoscaley_on(True) |
| 1617 | + self.ax2.set_autoscaley_on(True) |
1626 | 1618 |
|
1627 | 1619 | FigureCanvasQTAgg.resizeEvent(self, event)
|
1628 | 1620 | if self.isKeepDataAspectRatio() or self._hasOverlays():
|
@@ -1673,6 +1665,9 @@ def draw(self):
|
1673 | 1665 | if xLimits != self.ax.get_xbound() or yLimits != self.ax.get_ybound():
|
1674 | 1666 | self._updateMarkers()
|
1675 | 1667 |
|
| 1668 | + self.ax.set_autoscaley_on(False) |
| 1669 | + self.ax2.set_autoscaley_on(False) |
| 1670 | + |
1676 | 1671 | if xLimits != self.ax.get_xbound():
|
1677 | 1672 | self._plot.getXAxis()._emitLimitsChanged()
|
1678 | 1673 | if yLimits != self.ax.get_ybound():
|
|
0 commit comments