Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

warning from matplotlib #4203

Open
payno opened this issue Jan 21, 2025 · 3 comments · May be fixed by #4204
Open

warning from matplotlib #4203

payno opened this issue Jan 21, 2025 · 3 comments · May be fixed by #4204

Comments

@payno
Copy link
Member

payno commented Jan 21, 2025

Matplotlib 3.10 generate new warning:

Ignoring fixed y limits to fulfill fixed data aspect with adjustable data limits.

It can be reproduce when resizing the widget obtained by the following code:

import numpy
from silx.gui import qt
from silx.gui.plot import Plot2D

app = qt.QApplication([])

widget = Plot2D()
widget.show()
data = numpy.random.rand(100).reshape(10, 10)
widget.setKeepDataAspectRatio(True)
widget.addImage(data)

app.exec_()
@payno payno assigned payno and unassigned payno Jan 21, 2025
@payno
Copy link
Member Author

payno commented Jan 21, 2025

apply_aspect warning is triggered when 'replot/self.draw' is called

@payno
Copy link
Member Author

payno commented Jan 21, 2025

The example they provide for this is also triggering the warning:

@payno
Copy link
Member Author

payno commented Jan 21, 2025

I would expect to set set_autoscaley_on in the setKeepDataAspectRatio of the matplotlib backend should be enough but it doesn't looks like this is the case

    def setKeepDataAspectRatio(self, flag):
        print("flag", 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)

Looks like the autoscale is reset from setting limits during self._forceResetZoom callback is triggered during resizing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant