How do i set x axis to value of pandas df?

I’m plotting OHLCV values with bokeh and having hard time figuring out how to set x axis to corresponding “open_time” from panda df.

This is how i plot

p = figure(plot_width=900, plot_height=400)#, x_axis_type='datetime')
    p.segment('bar', 'high', 'bar', 'low', source=src, line_width=1, color='black')  # plot the wicks
    p.vbar('bar', 0.7, 'close', 'open', source=src, line_color='white', fill_color='colors', )  # plot the body

    hover = HoverTool(tooltips=[
        ('date', '@open_time{%F %T}'),
        ('open', '@open{0.0000f}'),
        ('high', '@high{0.0000f}'),
        ('low', '@low{0.0000f}'),
        ('close', '@close{0.0000f}')
    ],
        formatters={'@open_time': 'datetime'})
    p.add_tools(hover)

Hi @BiggestSmile ,

Can you post a minimal, reproducible example (with sample data) so that someone can copy and paste your code and run it to see what you’re seeing?

I’ve managed to do something about it. I’ve now got correct dates at x axis. However, my “vbar” part is missing from the plot for some reason

Found out that vbars are there, just it’s scale is very small
Changed to 200000 to look like 1 with the default x-axis
I guess it’s due to being default ticker size of ms & 1 of width
Is there any way to account for this without the huge numbers?

Datetime axes are always denominated in ms since epoch. IIRC you can supply an actual datetime interval object for the width and it be converted automatically. But if you need/want to pass a plain number, it needs to be in the correct units (ms).