matplotlib ginput does not allow the figure suptitle to change

115 Views Asked by At

I am trying to write a piece of code where the title of the figure changes before using ginput. However, it looks like the title changes only after pressing once on the figure, not before.

Here a few lines of code that reproduce the issue.

import matplotlib.pyplot as plt
events = ['1st','2nd']

fig, axs = plt.subplots(nrows = 2, ncols = 1, sharex=True)

for event in events:
    fig.suptitle('{} event.'.format(event))   
    pts = plt.ginput(-1, timeout=0, show_clicks = True)

Do you know why is that?

0

There are 0 best solutions below