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

Convert powers in scientific notations to RichText. #4424

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

himcraft
Copy link

Description

Fixes #2467

Showoff.showoff() selects :scientific notations when the range of tick values is too large or too small. However, the function returns the powers as Unicodes that are eventually rendered as the default font "DejaVuSans", which looks a little weird together with other fonts.

The fix adds an additional conversion based on showoff_minus. It will first find any "x10" in the raw tick labels, and then convert the following Unicode characters into a superscript of the RichText type.

However, as this is my first PR to Makie.jl, and the fix is rather rough. I am not sure if this fix is suitable to be merged. Any suggestions and guidance are welcomed :)

Type of change

Delete options that do not apply:

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist

  • Added an entry in CHANGELOG.md (for new features and breaking changes)
  • Added or changed relevant sections in the documentation
  • Added unit tests for new algorithms, conversion methods, etc.
  • Added reference image tests for new plotting functions, recipes, visual options, etc.

@himcraft
Copy link
Author

After fix.

test

Before fix.

test_old

@jkrumbiegel
Copy link
Member

jkrumbiegel commented Sep 29, 2024

Oh yeah this has annoyed me for a long time, and the reason I haven't fixed it is exactly because manipulating the strings directly is not the prettiest solution.

I would suggest we do this right and add the necessary capability to Showoff first. Probably that would mean adding a function there that outputs these ticks as tuples of the numeric components so we can do the formatting on those instead. This must already exist in there anyway because they have to get to the current strings somehow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Work in progress
Development

Successfully merging this pull request may close these issues.

Font of exponents sticks to default when the axis scales are regular.
2 participants