Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change figure window title in pylab

How can I set a figure window's title in pylab/python?

fig = figure(9) # 9 is now the title of the window fig.set_title("Test") #doesn't work fig.title = "Test" #doesn't work 
like image 516
Omar Avatar asked Apr 28 '11 02:04

Omar


People also ask

What is matplotlib PyLab?

PyLab is a procedural interface to the Matplotlib object-oriented plotting library. Matplotlib is the whole package; matplotlib. pyplot is a module in Matplotlib; and PyLab is a module that gets installed alongside Matplotlib. PyLab is a convenience module that bulk imports matplotlib.

How do I change the window size in matplotlib?

For all backends, the window size is controlled by the figsize argument. In general, for any matplotlib figure object, you can also call fig. set_size_inches((width, height)) to change the size of the figure.


1 Answers

If you want to actually change the window you can do:

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

Update 2021-05-15:

The solution above is deprecated (see here). instead use

fig = pylab.gcf() fig.canvas.manager.set_window_title('Test') 
like image 117
Andrew Walker Avatar answered Sep 20 '22 14:09

Andrew Walker