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

Consistent decimals in gradient legend #268

Open
grantmcdermott opened this issue Nov 25, 2024 · 0 comments
Open

Consistent decimals in gradient legend #268

grantmcdermott opened this issue Nov 25, 2024 · 0 comments

Comments

@grantmcdermott
Copy link
Owner

The current behaviour for gradient legends is a bit annoying because it can lead to inconsistent use of decimals in the swatch labels. For example, the 4, 3.5, etc. here:

plt(Sepal.Width ~ Petal.Width | Sepal.Width, iris, pch = 19, palette = "grays")

A simple solution is to tweak

lgnd_labs[labs_idx] = paste0(" ", lgnd_labs[labs_idx])

by wrapping with format:

lgnd_labs[labs_idx] = paste0(" ", format(lgnd_labs[labs_idx]))

Which leads to the nicer:

An easy fix, but will break a lot of tests, so maybe hold off until some of the bigger PRs are merged.

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

No branches or pull requests

1 participant