【发布时间】:2018-04-17 13:46:01
【问题描述】:
我有一个 Excel 表,我使用 pandas 库从中提取“TIME”和“TEMP”列。我想绘制使用 Bokeh plot 的温度与时间图。但是,散景图并未完全显示 X 轴值。相反,它只显示“时间”列的最后几个字符,即 x 轴。请帮忙 -
Python 代码 -
import pandas as pd
from bokeh.plotting import figure,output_file,show
from bokeh.models.ranges import Range1d
results=pd.read_excel("test.xls",parse_dates=["TIME"])
print(results['TIME'])
p=figure(plot_width=900,plot_height=500,x_axis_type="datetime",x_axis_label="TIME",y_axis_label="TEMPERATURE" )
p.vbar(x=results["TIME"],top=results["TEMP"],color="red",width=2.4,bottom=0)
p.y_range=Range1d(0,150)
output_file("Scatter_plotting.html")
show(p)
Excel 文件 - “test.xls”
散景图 -
如您所见,散景图 x 轴值未完全绘制。请帮忙。
【问题讨论】: