pythonmatplotlibfigure

Set matplotlib default figure window title


The default window title of a figure is figure X, where X is increased each figure.

I know how to change the title of a figure:

fig = pylab.gcf()
fig.canvas.set_window_title('Test')

But how do I change the default window title (So that it will be "Test 1", "Test 2" etc.), so that I will not need to change the window title each time?

I did not find a key in the mpl.rcParams


Solution

  • There is no key in mpl.rcParams since the default title is hardcoded in the backends. For example, have a look at the figure initialization code of the QT5 backend:

    self.window.setWindowTitle("Figure %d" % num)
    

    This means you cannot change the default window title unless you change the code of the matplotlib module itself.