我有一个与此类似的Pandas数据帧:
person activities hours foodeaten
0 1 a 3 12
1 1 b 4 14
2 1 c 6 34
3 2 a 2 45
4 2 b 7 67
5 3 a 5 5
6 3 b 3 -1
7 3 c 2 3
8 3 d 12 5
我想画出一个人在一项活动上,每项活动所花费的时间。 因此,图1:活动a,x=人员y=活动a的小时数 图2:活动b,x=人员y=活动b的小时 等等
我想根据人而不是索引来链接情节。所以,当我在图1中为1号人物选择圆圈时,这个人在其他图中的小时数也应该突出显示,这也是我的目的。在
MWE:
^{pr2}$
Bokeh没有任何内置于这种自动链接的东西。但是,可以使用
CustomJS
回调根据对另一个字形的选择来更新一个字形的选择:使用此代码,选择左红色圆圈将选择所有右侧红色圆圈,蓝色圆圈也将相同:
请注意,上面的代码显式地手动编码索引之间的关系,以便说明通用技术(即,它手动指定一个表)。您可能需要使用有关特定数据的知识和假设来构建一个更通用的
CustomJS
回调,它可以计算自动设置哪些索引。在以下是任意数量绘图的工作示例:
相关问题 更多 >
编程相关推荐