Search code examples
bokeh

Can I set the x-axis pivot on a positive/negative barchart as something other than zero?


I'm using a barchart to show performance metrics from Jan to June and 99% is my baseline metric. Anything above 99 is acceptable, shown with a green bar extending right-wards, anything below 99 is deemed unacceptable, shown with a yellow bar extending left-wards.

I made a mock up using positive and negative numbers with zero as the natural pivot point. I was looking in the docs for a way to change this x-axis pivot point and couldn't find any, i.e. make my new pivot point 99. Attached is a visual of what I mean.

enter image description here

Is there any way to manually set the x-axis pivot point?

I know what I'm looking for can be achieved with a stacked bar chart/the use of quads, etc. Just wondering if there's a way to proceed with the original hbar object.

Thanks all.

Update: Eugene Pakhomov's answer did the trick...

p.hbar(left=99, y='months', right='counts', height=0.9, source=source...)

Solution

  • hbar has left argument that's 0 by default. Just set it to 99.