
I wanted to add vertical bands using Span() to represent weekends in a datetime plot but it seems that the default line_width defaults to ‘screen’ and not ‘data’ as stated in the documents even when explicitly mentioned.
You can reproduce this using the example in the user guide Annotations — Bokeh 3.6.2 Documentation
If you zoom-in the green bands always stay 5 pixels wide.
For my case I would expect the Span width to adjust to the equivalent of 2 days (Saturday + Sunday) using units based on unix timestamp so 2 * 24 * 3600 * 1000
Here is minimal code of my case:-
plot = figure(title='daily kw total', x_axis_type='datetime',height=300, width=480)
plot.vbar(x='ts', top='tn', width=0.8 * 24 * 3600 * 1000, fill_color="green", source=source2)
for we in (dt.datetime(2024, 11, 23, 0, 0, 0), dt.datetime(2024, 11, 30, 0, 0, 0)):
st = Span(location=we, dimension='height', line_alpha=0.1, line_color='grey', location_units='data', line_width = 2 * 24 * 3600 * 1000)
plot.add_layout(st)
I tried explicitly stating in Span location_units = ‘data’ hoping this would match the relative width of my vbar glyphs which follow the xaxis datetime format and zoom correctly.
Is this a bug or am I missing something?

