transform_jitter#
网格中的两个散点图。本示例演示了将 jitter
变换应用于数据。
细节
- 样本数据:
- Bokeh API:
figure.scatter
,bokeh.layouts.column
,bokeh.transform.jitter
- 更多信息:
- 关键词:
column, jitter, scatter
from bokeh.layouts import column
from bokeh.plotting import figure, show
from bokeh.sampledata.autompg import autompg
from bokeh.transform import jitter
years = sorted(autompg.yr.unique())
p1 = figure(width=600, height=300, title="Years vs mpg without jittering")
p1.xgrid.grid_line_color = None
p1.xaxis.ticker = years
p1.scatter(x='yr', y='mpg', size=9, alpha=0.4, source=autompg)
p2 = figure(width=600, height=300, title="Years vs mpg with jittering")
p2.xgrid.grid_line_color = None
p2.xaxis.ticker = years
p2.scatter(x=jitter('yr', 0.4), y='mpg', size=9, alpha=0.4, source=autompg)
show(column(p1, p2))