Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Description
Bug summary
When using the gtk4cairo backend, and using a scaled resolution, part of the graph will be cut off.
From the bug reports onGraphs, it seems like with 200% scaling, only 1/2 of the screen is used, and at 300% scaling it's about 1/3 of the screen etc...
See attached screencast. It goes back to normal when scaling is set to 100%.
Screencast.from.2023-05-10.10-45-40.webm
Code for reproduction
importmatplotlibmatplotlib.use("gtk4cairo")importmatplotlib.pyplotaspltimportnumpyasnp# Data for plottingt=np.arange(0.0,2.0,0.01)s=1+np.sin(2*np.pi*t)fig,ax=plt.subplots()ax.plot(t,s)ax.set(xlabel='time (s)',ylabel='voltage (mV)',title='About as simple as it gets, folks')ax.grid()fig.savefig("test.png")plt.show()
Actual outcome
The plot should always stretch over the entire area, and never cut off.
Expected outcome
The plot is cut off when using a scaled resolution. Note that it works fine with the gtk4agg backend, so it's definitely a bug in gtk4cairo. However, gtk4agg backend has other issues that prevent me from using that in Graphs.
Additional information
I have been using Fedora 38 Silverblue on my computer, attached screencast is from a Fedora 36 toolbox. Problem persists in a Flatpak, and initial bug report on Graphs was from somebody running a Fedora 36 workstation desktop it seems.
Note that the filled in versions below are from the environment that runs in my Toolbox container. But the problem persists in the Flatpak which runs Gnome 44 runtimes with Matplotlib 3.7.1 installed by Pip.
See issue onGraphs for the context where I initially got confronted with this bug.
Operating system
Linux Fedora Silverblue
Matplotlib Version
3.6.0
Matplotlib Backend
GTK4Cairo
Python version
Python 3.10.8
Jupyter version
6.4.12
Installation
Linux package manager