python - 具有分类数据和条形位置控制的 Bokeh vbar
问题描述
我正在尝试制作一个 vbar 散景图,我可以在其中为分类数据添加标签并控制条形的位置。我尝试了以下方法:
# importing the modules
from bokeh.plotting import figure, output_file, show
# file to save the model
output_file("gfg.html")
# instantiating the figure object
graph = figure()
# x-coordinates to be plotted
x = [1, 2, 3, 5, 8]
# x-coordinates of the top edges
top = [1, 2, 3, 4, 5]
# tick labels
tick_labels = ["Team 1", "Team 2", "Team 3", "Team 4", "Team 5"]
# plotting the graph
graph.vbar(x, top = top, width = 0.6)
# displaying the model
show(graph)
结果可以控制条形的位置,但不能控制 x 轴上的“团队”标签。我尝试了不同的组合,我可以获得标签,但失去了对条形的放置控制。非常感谢任何帮助或建议。吉诺
解决方案
推荐阅读
- html - div元素的CSS骨架动画
- sql-server - 插入到 sql server 的温和方式
- angular - @auth0/auth0-angular 中是否有使用电子邮件和密码登录的方法?
- mysql - SQL查询根据开始和结束时间查找并发会话
- typescript - 未提供“invokeMiddleware”的参数
- javascript - 在 JavaScript 中转义撇号等
- javascript - 如何在反应中更改日期格式?
- sql - SQL。比较当前行的值与上一行的相同比较结果的值
- reactjs - 如何在codepen中运行使用“create-react-app”创建的反应项目?
- java - 方法 count(JobViewWrapper) 已经定义