Use axis in a "conventional" way?

Hi all,

I’m trying to have some mathematical plot done and my teacher asks the axis to be centered like in a normal Cartesian coordinate system and not at the corners. Is this possible with bokeh?

Thanks

I don’t think it’s possible with built-in Bokeh models. But you should be able to achieve this by creating a custom Axis model. If it’s just for a single assignment, then you should probably use some other plotting library that has such functionality built into it.

@mmaridev

Check out the fixed_location property of an axis. This coupled with setting the axes ranges explicitly might be able to do what you want if I understand the question correctly.

https://docs.bokeh.org/en/latest/docs/reference/models/axes.html?highlight=axis#bokeh.models.axes.Axis

Example

1 Like

@_jm thank you so much! Exactly what I was looking for.

p.axis[0].fixed_location = 0
p.axis[1].fixed_location = 0

Oh, I stand corrected, thank you!