I have been changing matplotlib figure number to text strings and would like to subsequently add to that string later to display some stays info. Can’t seem to find a way that works, can anyone suggest a way to do this?
The idea is to be able to stack plots on screen like index cards with only the figure num text exposed for picking.
figs = []
x,y = 100,100
for i in 0,1,2,3,4:
fig = plt.figure(num=f'P1105{str(i)}')
print(fig._label)
figs.append(plt.figure(num=f'P1105{str(i)}'))
fig.canvas.manager.window.setGeometry(x, y+i*25, 300, 100)
# attempt to edit the figure labels
for i in 0,1,2,3,4:
fig = plt.figure(f'P1105{str(i)}')
print('original _label is {fig._label}')
# update figure reference num, special variable _label, and redraw
fig._label = f'new _label is P1105{str(i)} for figure {i}'
print(fig._label)
fig.canvas.manager.set_window_title(fig._label)
fig.canvas.draw()
To display code properly you can wrap it in triple backticks (```). The forum UI has a button </> that will do this for you: select the code, click the button, and it’ll display properly.
Regarding your question, it’s been a long while since I worked with individual matplotlib windows like this[1]. Searching around a bit, have you tried this: