☰Read-only archive⌕
Looking for help with Bokeh?

This is a read-only archive. Ask questions and join the conversation on GitHub.

Visit Community Support on GitHub →
Archived discussions · Captured October 28, 2026

Dual x-axis tickers not working when axes separated

Community Support
Albert_Chau1
Albert_Chau1

Hi,

With bokeh 0.12.13

When adding a second x-axis, the tickers don’t work if the original axis is placed below the plot (default) and the second x-axis is placed above.

import bokeh.plotting as BPlotting
import bokeh.models as BModels
num_chans = 6
x = [16, 32, 64, 96, 128]
y = [10, 15, 20, 24, 25]
ticks = x
ticks_t = [i*num_chans for i in x]
spacer = 1.2
p = BPlotting.figure( x_axis_type=‘log’, x_range=(ticks[0]/spacer, ticks[-1]*spacer) )
p.line(‘x’, ‘y’, source=BPlotting.ColumnDataSource(data=dict(x=x, y=y)))
p.xgrid.ticker = BModels.FixedTicker(ticks=ticks)
p.xaxis[0].ticker = BModels.FixedTicker(ticks=ticks)
p.xaxis[0].formatter = BModels.PrintfTickFormatter(format=“%d kbps/ch”)
p.extra_x_ranges[‘total’] = BModels.Range1d(start=ticks_t[0]/spacer, end=ticks_t[-1]*spacer)
p.add_layout( BModels.LogAxis(x_range_name=‘total’), ‘above’ ) # doesn’t work
#p.add_layout( BModels.LogAxis(x_range_name=‘total’), ‘below’ ) # works as expected
p.xaxis[1].ticker = BModels.FixedTicker(ticks=ticks_t)
p.xaxis[1].formatter = BModels.PrintfTickFormatter(format=“%d Tot kbps”)
BPlotting.output_file(‘dual_x.html’)
BPlotting.save(p)

This combination (first x-axis below, second x-axis above) is the only one that misbehaves. Both above, both below, or first above and second below work as intended.

Bokeh bug? or is there something wrong in my code?

Also, browser reports warning related to my use of log-scale x-axis:

“LogTickFormatter not configured with a ticker, using default base of 10 (labels will be incorrect if ticker base is not 10)”

OK to ignore this warning? Or if it is a concern, how do I correct it?

thanks

albert.

⌁   Link to post
Bryan
Bryan

Albert,

This is definitely a bug (and an odd one!) Can you make a new GH issue with this code?

  Issues · bokeh/bokeh · GitHub

Regarding the log ticker message, that is a harmless message. It should probably be changed to a "debug" log rather than a "warning".

Thanks,

Bryan

···

On Dec 19, 2017, at 20:04, Albert Chau <albertdude@gmail.com> wrote:

import bokeh.plotting as BPlotting
import bokeh.models as BModels
num_chans = 6
x = [16, 32, 64, 96, 128]
y = [10, 15, 20, 24, 25]
ticks = x
ticks_t = [i*num_chans for i in x]
spacer = 1.2
p = BPlotting.figure( x_axis_type='log', x_range=(ticks[0]/spacer, ticks[-1]*spacer) )
p.line('x', 'y', source=BPlotting.ColumnDataSource(data=dict(x=x, y=y)))
p.xgrid.ticker = BModels.FixedTicker(ticks=ticks)
p.xaxis[0].ticker = BModels.FixedTicker(ticks=ticks)
p.xaxis[0].formatter = BModels.PrintfTickFormatter(format="%d kbps/ch")
p.extra_x_ranges['total'] = BModels.Range1d(start=ticks_t[0]/spacer, end=ticks_t[-1]*spacer)
p.add_layout( BModels.LogAxis(x_range_name='total'), 'above' ) # doesn't work
#p.add_layout( BModels.LogAxis(x_range_name='total'), 'below' ) # works as expected
p.xaxis[1].ticker = BModels.FixedTicker(ticks=ticks_t)
p.xaxis[1].formatter = BModels.PrintfTickFormatter(format="%d Tot kbps")
BPlotting.output_file('dual_x.html')
BPlotting.save(p)

⌁   Link to post

End of archived discussion · Replies are disabled