☰Read-only archive⌕
Looking for help with Bokeh?

This is a read-only archive. Ask questions and join the conversation on GitHub.

Visit Community Support on GitHub →
Archived discussions · Captured October 28, 2026

Datetime on y axis for hbar and/or harea

Community Support
AlainD
AlainD

I am trying to make a hbar in which the vetrical axis (y_axis) is a datetime.

The following does not work:

from bokeh.sampledata.stocks import AAPL
AAPL[‘date’] = to_datetime(AAPL[‘date’])
ko = figure(y_axis_type=“datetime”)
ko.hbar(y=AAPL[‘date’], right=AAPL[‘open’], height=1006060*24, color=“lightgrey”)
ko.line(y=AAPL[‘date’], x=AAPL[‘open’], color=“grey”)
show(ko)

What puzzeles me is that it works if I remove the hbar line:

ok = figure(y_axis_type=“datetime”)
ko.line(AAPL[‘open’], AAPL[‘date’], color=“grey”)
show(ok)

Or when I change the x/y axis:

ok = figure(x_axis_type=“datetime”)
ok.vbar(AAPL[‘date’], top=AAPL[‘open’], width=1006060*24, color=“lightgrey”)
show(ok)

Is there a subtle way to count the datetime in nanoseconds in that case?

⌁   Link to post
p-himik
p-himik

The first argument to hbar is y. The first argument to line is x. I’m not sure what you want to achieve, but you’re definitely mixing something up.

To help mitigate such issues, you can just avoid using positional arguments with Bokeh altogether. Well, maybe except for really trivial cases like ColumnDataSource(data).

⌁   Link to post

End of archived discussion · Replies are disabled