我试图从一个数据帧绘制一个简单的热图,如下所示:
row column content amount
0 x a c1 1
2 x b c3 3
4 x c c2 1
6 y a c1 1
8 y b c3 3
10 y c c2 1
12 z a c1 1
14 z b c3 3
16 z c c2 1
row
和column
表示单元格的位置,它的颜色应该基于content
来选择,我想要显示content
和{
我现在这样做(使用bokeh 1.2.0):
^{pr2}$但是,有两个问题:
有什么想法为什么?在
2)当我对color_bar = ...
部分置评时,我收到一个错误消息:
ValueError: expected an instance of type ContinuousColorMapper, got CategoricalColorMapper(id='3820', ...) of type CategoricalColorMapper
我做错什么了?在
对于你的colorBar解决方案就在这里,我还不明白你的来源到底发生了什么,下次我会再深入挖掘一点。 colorBar需要一个连续的映射器,你给了它一个分类。在
您的x和y坐标被交换,应为:
至于另一条消息,这是不言而喻的:从bokeh1.2开始,
ColorBar
只能配置为连续的颜色映射器(例如LinearColorMapper
)。您可以:source
中包含一列颜色,或者LinearColorMapper
(即将content
映射到某个数字比例)相关问题 更多 >
编程相关推荐