hex_tile#
一个使用随机选择点的手动六边形格网图。此图表显示了来自正态分布的 50,000 个点,并使用 hexbin
实用函数将这些点分箱到六边形瓦片中。这些瓦片根据其箱计数进行线性颜色映射。
详情
- Bokeh API:
figure.hex_tile
,bokeh.transform.linear_cmap
,bokeh.util.hex.hexbin
- 更多信息:
- 关键词:
hex, hex_tile, colormap
import numpy as np
from bokeh.plotting import figure, show
from bokeh.transform import linear_cmap
from bokeh.util.hex import hexbin
n = 50000
x = np.random.standard_normal(n)
y = np.random.standard_normal(n)
bins = hexbin(x, y, 0.1)
p = figure(title="Manual hex bin for 50000 points", tools="wheel_zoom,pan,reset",
match_aspect=True, background_fill_color='#440154')
p.grid.visible = False
p.hex_tile(q="q", r="r", size=0.1, line_color=None, source=bins,
fill_color=linear_cmap('counts', 'Viridis256', 0, max(bins.counts)))
show(p)