这是一个简化的可复制代码。我的 bokeh
版本是 2.2.3
。
import bokeh.plotting as bop
from pandas import Timestamp
from bokeh.models import ColumnDataSource, Patches
x1 = Timestamp('2019-08-27 09:40:00')
x2 = Timestamp('2019-08-27 09:40:00.001')
x = [x1, x1, x2, x2]
y = [50.89, 50.88, 50.88, 50.89]
fig = bop.figure(x_axis_type="datetime")
source = ColumnDataSource(dict(xs=[x], ys=[y]))
glyph = Patches(xs="xs", ys="ys", fill_color="aqua", line_color=None)
fig.add_glyph(source, glyph)
bop.output_notebook()
bop.show(fig)
似乎如果我们将 x2
更改为 Timestamp('2019-08-27 09:50:00.001')
,一切都会恢复正常。所以,我想可能是因为日期时间轴的分辨率太低?