8000 [BUG] Log axis exponents react differently when font size is defined in anything but px (e.g. pt) · Issue #11006 · bokeh/bokeh · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
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

Closed
ethankruse opened this issue Mar 5, 2021 · 2 comments

Comments

@ethankruse
Copy link

Hi,

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]

output_file("log.html")

# 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)
p.circle(x, y, fill_color="white", size=8)

p.axis.major_label_text_font_size = "20px"

show(p)

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:

em|ex|ch|ic|rem|vw|vh|vi|vb|vmin|vmax|cm|mm|q|in|pc|pt|px

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

@mattpap
Copy link
Contributor
mattpap commented Mar 5, 2021

em|ex|ch|ic|rem|vw|vh|vi|vb|vmin|vmax|cm|mm|q|in|pc|pt|px

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.

Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants
0