我试图使用matplotlib制作一个交互式绘图,在这里我可以点击条形图的索引。这样,我就可以使用索引访问存储在数组中的一些细节,并将其打印出来。我有一个下面的代码示例,可以用于线形图
if isinstance(event.artist, Line2D):
thisline = event.artist
xdata = thisline.get_xdata()
ydata = thisline.get_ydata()
ind = event.ind
print('onpick1 line:', np.column_stack([xdata[ind], ydata[ind]]))
但是,我无法为条形图获取任何此类索引/索引。附近有工作吗
这些条是单独的补丁。您可以从返回的列表中获取修补程序的索引
相关问题 更多 >
编程相关推荐