VBar Shift "Anchor"

I want to shift vbars over a categorical x-axis…I’ve checked the documentation but can’t find anything, so hopefully the community can help me out.

I have a simple example:

source = ColumnDataSource(data=dict(
    x=['First', 'Second'],
    align=['center', 'left']

I want to use this CDS to make two vbars.
I want the first vbar to align directly over the categorical x (“First”). This is the default way it’s rendered.
But I want the second vbar to align to the left, so instead of being directly over the categorical x, it’s to the left.
For text glyphs, there is the ‘anchor’ value we can adjust to physically shift a subset of the glyphs, but is there something for bars?

I was picturing something like the below:
p.vbar(x='x', bottom=0, top='y', align='align',source=source)

Categorical offsets are described in the documentation:


This could also be accomplished with dodge


1 Like

Thank you, this is extremely helpful and just what I was looking for!

1 Like