Thomas Möbius Thomas Möbius - 1 year ago 98
Python Question

Adding a XClass properties to matplotlib's plots

I would like to have the window manager to, well, manage the plots. When I create a plot interactively in python:

from numpy import arange
import matplotlib
import matplotlib.pyplot as pt

x = arange(-10,10,step=.1)
pt.plot(x, x**3)

And check for the window properties, I get nothing.

% xprop | grep CLASS
WM_CLASS(STRING) = " ", " "

How can I tell matplotlib/Python to add X-window properties to its plots?

Answer Source

As it appears, this is not a problem of matplotlib nor is matplotlib the solution: Instead the backends seem to be responsible for creating the window clients and do the registration and settings of

Having switched from Qt5Agg to TkAgg, I suddenly have all the properties I could wish for:

% xprop | grep CLASS
WM_CLASS(STRING) = "tk", "Tk"
% xprop | grep WM_NAME
_NET_WM_NAME(UTF8_STRING) = "Figure 1"
WM_NAME(STRING) = "Figure 1"

My window manager (herbstluftwm) is now handling all newly created figures nicely.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download