Change picture window title in pylab

How to set shape window 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 
+51
python matplotlib
Apr 28 2018-11-11T00:
source share
4 answers

If you want to change the window you can do:

 fig = pylab.gcf() fig.canvas.set_window_title('Test') 
+79
Apr 28 2018-11-11T00:
source share
— -

Based on Andrew's answer, if you use pyplot instead of pylab, then:

 fig = pyplot.gcf() fig.canvas.set_window_title('My title') 
+13
May 2, '15 at 23:14
source share

I used fig.canvas.set_window_title('The title') with fig obtained with pyplot.figure() , and it worked well too:

 import matplotlib.pyplot as plt ... fig = plt.figure(0) fig.canvas.set_window_title('Window 3D') 

enter image description here

(It seems .gcf() and .figure() does a similar job here.)

+5
Jun 11 '16 at 10:53 on
source share

You can also set the window title when creating a picture:

 fig = plt.figure("YourWindowName") 
+4
Sep 05 '17 at 12:11
source share



All Articles