相关疑难解决方法(0)

如何使用 Python 3 在带有连续颜色图的“散景”中制作“热图”?

我试图来复制这种风格HeatMap是连续值映射到一个LinearColorMapper实例:http://docs.bokeh.org/en/latest/docs/gallery/unemployment.html 我想作一个HeatMap(W /无论是chartsrect),然后添加一个选择小部件来选择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)

plot colors widget heatmap bokeh

5
推荐指数
1
解决办法
4414
查看次数

从熊猫混乱矩阵的散景热图

如何将大熊猫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)

python pandas confusion-matrix bokeh

1
推荐指数
1
解决办法
2960
查看次数

标签 统计

bokeh ×2

colors ×1

confusion-matrix ×1

heatmap ×1

pandas ×1

plot ×1

python ×1

widget ×1