Nominal/categorical axis on a scatter plot

落爺英雄遲暮 提交于 2019-12-06 06:51:24

You need to supply the list of categories as the x_range or y_range explicitly. See:

http://docs.bokeh.org/en/latest/docs/gallery/categorical.html

Based on bigreddot's answer, x_range needs to be set explicitly as follows:

p = bk.figure(title = "scatter", x_range = x)

This is the complete example:

import bokeh.plotting as bk

# output to static HTML file
bk.output_file("scatter.html", title="scatter plot example")

x = ['a', 'b', 'c']
y = [0.5, 10.0, 5.0]

p = bk.figure(title = "scatter", x_range = x)
p.circle(x = x, y = y)
bk.show(p)
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!