Link 散景中的两个散点图
Link two Scatter charts in Bokeh
基于Bokeh docs,可以link使用plotting
界面创建两个散点图:
s1 = figure(plot_width=400, plot_height=400, title=None, tools=TOOLS)
s1.circle(x='Elevation', y='Aspect', source=src)
s2 = figure(plot_width=400, plot_height=400, title=None, tools=TOOLS)
s2.circle(x='Elevation', y='Slope', source=src)
但是,我想对散点图执行此操作,以便我可以利用自动样式设置(例如,按第 3 列着色)。这可能吗?我现在拥有的不工作的是:
s1 = Scatter(df_samp, x='Elevation', y='Horizontal_Distance_To_Roadways', color='Cover_Type', plot_height=400, plot_width=400, source=src, tools=TOOLS)
s2 = Scatter(df_samp, x='Elevation', y='Aspect', color='Cover_Type', plot_height=400, plot_width=400, source=src, tools=TOOLS)
bokeh.charts
API,包括 Scatter
已被弃用和删除。上面的第一个代码,使用稳定且受支持的 bokeh.plotting
API 是现在和将来所有情况下进行的正确方法。
如果您想基于其他列进行颜色映射,可以使用各种转换:
https://docs.bokeh.org/en/latest/docs/user_guide/data.html#transforming-data
基于Bokeh docs,可以link使用plotting
界面创建两个散点图:
s1 = figure(plot_width=400, plot_height=400, title=None, tools=TOOLS)
s1.circle(x='Elevation', y='Aspect', source=src)
s2 = figure(plot_width=400, plot_height=400, title=None, tools=TOOLS)
s2.circle(x='Elevation', y='Slope', source=src)
但是,我想对散点图执行此操作,以便我可以利用自动样式设置(例如,按第 3 列着色)。这可能吗?我现在拥有的不工作的是:
s1 = Scatter(df_samp, x='Elevation', y='Horizontal_Distance_To_Roadways', color='Cover_Type', plot_height=400, plot_width=400, source=src, tools=TOOLS)
s2 = Scatter(df_samp, x='Elevation', y='Aspect', color='Cover_Type', plot_height=400, plot_width=400, source=src, tools=TOOLS)
bokeh.charts
API,包括 Scatter
已被弃用和删除。上面的第一个代码,使用稳定且受支持的 bokeh.plotting
API 是现在和将来所有情况下进行的正确方法。
如果您想基于其他列进行颜色映射,可以使用各种转换:
https://docs.bokeh.org/en/latest/docs/user_guide/data.html#transforming-data