Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Log axis exponents react differently when font size is defined in anything but px (e.g. pt) #11006

ethankruse opened this issue Mar 5, 2021 · 1 comment


Copy link


I was excited to see 2.3.0 starts to include exponents for large numbers. However, it seems a bit buggy, in that it works if you define your font size in "px" but not in "pt" or any other units so far as I can tell.

Taking the doc's log axis example, I just add a single line setting a custom font size.

from bokeh.plotting import figure, output_file, show

x = [0.1, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0]
y = [10**xx for xx in x]


# create a new plot with a log axis type
p = figure(plot_width=400, plot_height=400, y_axis_type="log")

p.line(x, y, line_width=2), y, fill_color="white", size=8)

p.axis.major_label_text_font_size = "20px"


Using "20px" works as expected:

Screen Shot 2021-03-05 at 2 35 30 PM

Using a font size of "20pt" instead causes the exponents to have the same font size as the base numbers, which looks wrong and takes up way more space.

Screen Shot 2021-03-05 at 2 36 05 PM

Digging into the code, it seems like you theoretically accept font sizes in these units:


and using any other of those units aside from px causes the same problem.

Copy link

mattpap commented Mar 5, 2021


Theoretically, but only absolute units will work reliably (at some point we may get back to PR #10259 that adds support for relative units). So, pt should work, but the new implementation of log axis labels works only with px. It assumes that normalization to px units happens before this, but that doesn't actually happen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

No branches or pull requests

3 participants