我正试图使它在点击图形上的一个条时,一个新的图形用不同的数据绘制。当前,单击功能正常工作,但未绘制新图形:
# Standard plotly imports
import plotly as py
import plotly.graph_objs as go
#dataset1
x = ['a', 'b', 'c', 'd', 'e']
y = [10, 20, 30, 5, 25]
#dataset2
a = ['f', 'g', 'h', 'i', 'j']
b = [40, 80, 100, 10, 15]
#create first figure
f = go.FigureWidget([go.Bar(x = x, y = y)])
bar = f.data[0]
#click function to create new figure
def new_figure(trace, points, selector):
for i in points.point_inds:
print("CLICK")
new = go.FigureWidget([go.Bar(x = a, y = b)])
bar2 = new.data[0]
new
bar.on_click(new_figure)
f
有没有关于第二个数字没有被描绘出来我做错了什么的想法?提前谢谢
目前没有回答
相关问题 更多 >
编程相关推荐