Skip to content
Advertisement

Bokeh – draw top and right axes

I think this is very straightforward, but I cannot find an answer to it. I am trying to have a bokeh scatter plot with both the top and right axis drawn. I would like to have something like this (generated using gnuplot):

gnuplot

Here is my simple bokeh code:

JavaScript

Resulting in:

bokeh

So I want to be able to mirror the left/right and top/bottom axes. I’ve tried using LinearAxis() in bokeh without success. By adding the following lines:

JavaScript

I got close, but not quite there yet:

bokeh2

I did not find a way to remove the numbers on top/right and also have the tic marks inside. Any help is appreciated. Thank you in advance!

UPDATE

I was able to get the desired layout based on the accepted answer:

JavaScript

bokeh3

Advertisement

Answer

You can specify text attributes of the tick marks when creating the Axis object:

JavaScript

Here are the relevant docs: https://docs.bokeh.org/en/latest/docs/reference/models/axes.html

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement