Sharing python matplotlib window with zoom over chromium

I am using Fedora 34 with Gnome on wayland.
Now I need to attend a zoom conference and present some python matplotlib plots.
The plot is interactive, so cannot use a simple picture.
I usually use chromium for zoom conferences and can share xwayland windows.
So, how can I force python matplotlib to use xwayland instead of wayland?


From what I see, Matplotlib supports different backends. So by choosing one that uses X, you’ll get matplotlib to use X. The problem is that I can’t find any information on what backend uses X in the docs:

There are lots of posts over the internet when you search for "matplotlib backend Xorg` and so on, so maybe give those a look for clues. Otherwise, I’d just ask on the Matplotlib support channels directly and they should know.

My personal (foolproof!) solution in such cases is to logout and back in to Gnome on X and then not have to worry about such issues for the meeting :slight_smile:

1 Like

Thanks, I know about different backends (Fedora had trouble with some before), but it is a bit difficult to find out which one always uses X11. I suppose I might use a gtk backend and an environment variable to force X11 usage, but I was actually hoping some Fedora user knows which backend works and how to convince it to use X11 :smiley:

Yes, I am aware of the foolproof version, but first of all I do not like logging out and in frequently, and secondly I am actually very happy that wayland apps do not even show up when sharing the screen. So I cannot accidentally share something I do not want others to see (such as my secret notes on the second screen which make me look very smart, I hope :wink: ). Plus, I do not trust zoom (they have a history, such as being very difficult to remove once installed), so better to keep as much stuff hidden from them as possible.

OK, I found a solution. Thanks to some nice stackoverflow I was able to quickly figure out that my system currently supports the matplotlib backends ‘GTK3Agg’, ‘QTAgg’, ‘QtCairo’, ‘Qt5Agg’ and ‘WebAgg’. All of these natively support wayland (well, in case of WebAgg it depends on the browser), so I had to set the environment variable GDK_BACKEND=x11 (for GTK3Agg) or QT_QPA_PLATFORM=xcb (for the Qt based backends) to force xwayland usage. Then everything works smooth and I can finally share my interactive matplotlib plots during presentations :slight_smile:

1 Like