plt.ion() is preventing MultiCursor from working

无人久伴 提交于 2021-02-11 15:17:49

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!