问题
My full code can generate multiple Matplolib plots in multiple windows. This is how I want it as sometimes I want to see them on 2 screens and see a variety of outputs at the same time. Each window has several 'sharey' subplots and I want to share the cursor, using MultiCursor in the Vertical axis. I am using plt.ion() so that the multiple windows are non-blocking, i.e. they all open at the same time rather than one opening when the previse is closed. When I run the code, plt.ion() seems to block the function of MultiCursor; if it turn off plt.ion(), MultiCursor works, if it is active, then MultiCusor does not function. This happens even if I only open one plot window. Is there a way to keep the option to open multiple plot windows at the same time, but also share the cursor, at least on the window I am active on?
def Raw_Plot(): #Raw Data Plot
global unitW
fig, axs=plt.subplots(1,6,constrained_layout=True, sharey=True)
# Code for each subplot goes here
multi=MultiCursor(fig.canvas,(axs[0],axs[1],axs[2],axs[3],axs[4],axs[5]),color='r',lw=1,horizOn=True, vertOn=False)
plt.ion() #makes plot non-blocking - Can open multiple plots
plt.show()
来源:https://stackoverflow.com/questions/63267985/plt-ion-is-preventing-multicursor-from-working