2

How can I activate bokeh axis ticks (not necessarily the tick labels nor the axis label, although that may be helpful too) on both sides of a plot simultaneously?

For reference, in matplotlib I would set tick_params (e.g. bottom, top and left, right) all to True.

2 Answers 2

3

The axis_location parameter to figure is a convenience for the common case of adding one axis. Multiple axes can always be added explicitly using Plot.add_layout e.g.

 plot.add_layout(LinearAxis(), 'left') plot.add_layout(LinearAxis(), 'right') 

There is an extreme example that exercises the addition of many axes and titles here:

https://github.com/bokeh/bokeh/blob/master/examples/models/file/panels.py

enter image description here

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks. I was hoping for something I would be able to set through a Theme. So your reply probably means it is not that easy yet. Adding an axis the way you suggest does involve, if I understand correctly, indexing into the specific layout, then retrieving axis names of the one you'd want to 'mirror', so it may be harder to automate.
Exposing as a theme might be difficult, but we could probably add new values that xaxis_location understands, to add both sides. Feel free to open a GH issue to discuss
-2

As far as I can tell, for fixed lines you do:

p.xaxis.ticker = [2, 3.5, 4] 

Here is a link with many more examples, in order to achieve the exact thing you are after, ticker examples . Hope this helps.

1 Comment

Thanks for your reply. That only seems to change the locations of the ticks and does not 'mirror' those ticks onto the upper boundary of the plot, though.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.