Issue setting major ticks on LogTicker

Hi there,

I’m trying to make a box plot with some values spanning ~3 orders of magnitude on a log y axis. I’d like to have more major tick values on the y axis than just the integer powers of 10, but I can’t seem to get it to. I’ve tried setting all the relevant-seeming LogTicker attributes to no avail.

desired_num_ticks appears to be disregarded. No set of integers in mantissas appears to change anything. The min and max intervals also don’t seem to do much here.

Weirdly enough if I zoom in the plot, the additional major ticks appear, but I’d like them to also be present for the inital graph.

I’m a bit stumped, is this intended LogTicker behaviour or have I missed something? I’d appreciate it if someone could give some guidance!

Here’s a snippet which produces the following plot with high desired_num_ticks in Jupyter Notebook; bokeh 3.1.1:

from bokeh.plotting import figure
from bokeh.models import PrintfTickFormatter, LogTicker
from bokeh.io import output_notebook, show

output_notebook()

data = [0.01,0.18,11.5,0.025,1.7]
categories = ['A', 'B', 'C', 'D', 'E',]

p = figure(width=400, height=400, x_range=categories, y_axis_type='log', y_range=(0.008, 20))
p.vbar(x=categories, top=data, bottom=10**-10)
p.yaxis.formatter = PrintfTickFormatter(format="%1.1f")
p.yaxis.ticker = LogTicker(base=10, mantissas=[2,5], num_minor_ticks=5, desired_num_ticks=20)
show(p)

desired_num_ticks appears to be disregarded.

desired_num_ticks is only a suggestion, and tickers can ignore it. To be honest it is cruft left over from very early versions of this code that were inspired by a different rich client visualization library that some of us worked on ~15 years ago. The desired_num_ticks property should probably just be removed from all Ticker classes at this point as it is more confusing than helpful.

Similarly, LogTicker.mantissas also probably ought to be removed. The built-in LogTicker will only display decades of the base as major ticks. Properly the inheritance should be split so that mantissas only ends on classes that can actually use it. But AFAIK you are the first person in ~12 years to try using these properties, and as always in OSS the squeaky wheel gets the grease, so there has not be pressure for anyone to clean up this hierarchy.

Fair enough. I’ll use a fixed ticker.

Thanks for the answer!

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.