我试图来复制这种风格HeatMap是连续值映射到一个LinearColorMapper实例:http://docs.bokeh.org/en/latest/docs/gallery/unemployment.html
我想作一个HeatMap(W /无论是charts或rect),然后添加一个选择小部件来选择obsv_id,然后添加一个滑块小部件来浏览dates.
但是,一开始我在HeatMap使用单obsv_id/date对时遇到了麻烦。我在创建这个时做错了HeatMap什么?这本质上是size变量和loc变量的 3x3 矩形图。
奖励:你能帮我/就如何连接这些小部件的输出来控制情节提出一些建议吗?
我看到了这些帖子,但所有示例都使用实际的十六进制颜色作为列表,而不是使用连续度量进行映射: python bokeh,如何制作相关图? http://docs.bokeh.org/en/latest/docs/gallery/categorical.html
# Init
import numpy as np
import pandas as pd
from bokeh.plotting import figure, output_notebook, output_file, reset_output, show, ColumnDataSource
from bokeh.models import LinearColorMapper
reset_output()
output_notebook()
np.random.seed(0)
# Coords
dates = ["07-3","07-11","08-6","08-28"]
#locs = ["air","water","earth"]
locs = [0,1,2] …Run Code Online (Sandbox Code Playgroud) 如何将大熊猫DataFrame展示为散景热图?
https://bokeh.pydata.org/en/latest/docs/user_guide/categorical.html#heat-maps显示了一些示例,但尝试修改始终只给出了一个空图.
示例混淆矩阵:
df = pd.DataFrame([[10, 0, 1], [1, 10, 0], [1, 1, 9]],
columns=['A', 'B', 'C'],
index=['A', 'B', 'C'])
df.index.name = 'Treatment'
df.columns.name = 'Prediction'
Run Code Online (Sandbox Code Playgroud)