[英]bokeh x-axis datetime returning incorrect dates
I have a dataframe df2
with dates in string form and numbers 我有一个数据df2
,日期格式为字符串形式和数字
date | value
2018-02-02 130
2018-02-05 360
2018-02-06 98
2018-02-07 150
When I plot the dates in a plot along the x axis, the dates returned are incorrect. 当我沿x轴在图中绘制日期时,返回的日期不正确。 They seem to translate like so: 他们似乎这样翻译:
2018-02-06 = Jan 1, 1970 2018-02-05 = Jan 13.5, 1970
source=ColumnDataSource(data=df2)
p= figure(plot_width=700, plot_height=400, x_axis_type="datetime")
p.xaxis.formatter= DatetimeTickFormatter(days="%B/%d/%Y")
p.triangle("DATE","VALUE",color='black',source=source)
The glyphs don't fall exactly on the gridlines either. 字形也不完全落在网格线上。 What is happening? 怎么了?
p.triangle(df2["DATE"].dt.date,df2["VALUE"],color='Black')
will yield the date p.triangle(df2["DATE"].dt.date,df2["VALUE"],color='Black')
将产生日期
I have a nasty habit of finding the right answers shortly after posting it on stackoverflow. 我有一个讨厌的习惯,即在将其发布到stackoverflow之后不久就找到正确的答案。 I think I may do that more often! 我想我可能会更经常这样做!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.