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

Adding support for superscript exponents #8954

Closed
micrenda opened this issue May 30, 2019 · 6 comments · Fixed by #10828
Closed

Adding support for superscript exponents #8954

micrenda opened this issue May 30, 2019 · 6 comments · Fixed by #10828

Comments

@micrenda
Copy link

It would be very useful to me to have logarictimic axis values written as 10⁴¹ instead than 10^41.

I implemented a patch to add this feature, which add a new property LogTickFormatter.use_superscript_exponents:
https://github.com/micrenda/bokeh/tree/use_superscript_exponents

But there are two pending issues:

  1. It seems that this code is just ignored:
    p.xaxis[0].formatter.use_superscript_exponents = True
    (an expert Bokeh developer will surely find a solution)

  2. The exponents from 1 to 3 are rendered with a smaller font (I think this is a font related issues, changing fonts may help).

@bryevdv
Copy link
Member

bryevdv commented May 30, 2019

@micrenda In order see see effects from changes to the BokehJS source code, you have to:

  • compile BokehJS locally from the source
  • tell Bokeh to use your locally-built version (e.g. by setting BOKEH_RESOURCES)

These steps are described in the Developer Guide. I'd suggest going through that (I can answer any questions you have along the way) and then submitting a Pull Request to add this feature (we can discuss iterate on any changes in a Pull Request)

This seems like a reasonable thing and a small change, so I'd be pleased to consider a Pull Request from you

@micrenda
Copy link
Author

Thank you @bryevdv for your fast and kind response. I was able to fix the issue nr. 1 and to test it locally.

If you decide to accept my pull request, please be aware there is a small problem with the font size. It is not the fault of bokeh, but it is possible you will receive some complaints. Changing fonts may help (here you can find more details)
bokeh_plot

@micrenda
Copy link
Author

Setting this solve the problem with different superscript sizes:
p.axis.major_label_text_font = "sans"

@bryevdv
Copy link
Member

bryevdv commented Jul 16, 2019

going also to close this in favor of existing #6031

@bryevdv
Copy link
Member

bryevdv commented Feb 19, 2021

noting that #10828 will add support for superscript exponents even without mathtext support (which is also planned for later this year)

Screen Shot 2021-02-18 at 10 56 24 PM

@bryevdv
Copy link
Member

bryevdv commented Feb 19, 2021

re-opening to close with #10828

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