-
Notifications
You must be signed in to change notification settings - Fork 105
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
label_number_si accuracy when labelling 'K' and 'M' #264
Comments
With the current dev version: library(scales)
x <- c(0, 250, 500, 750, 1250, 1500) * 1e3
label_number_si("")(x)
#> [1] "0.00" "250.00k" "500.00k" "750.00k" "1.25M" "1.50M" Created on 2022-03-17 by the reprex package (v2.0.1) So it looks like we've solved one problem and created another (smaller) one 😄 |
I think probably we need to compute accuracy individually for each scale group (something like ... Of course, because the This need fixes everywhere that So maybe need to move |
* `number()` gets a new argument called `scale_cut`, equivalent to `dollar()`'s `rescale_large`. * `rescale_long_scale()` and `rescale_short_scale()` are renamed to `cut_short_scale()` and `cut_long_scale()` * Add new `cut_si()` and `cut_bytes()` to pull out the code previously nested inside `label_number_si()` and `label_bytes()`. This involved refactoring `scale_cut()` to take a vector of break points, not `log10` break points. Along the way, I also fixed #264 by refactoring `number()` to allow `accuracy` to be a vector (which then requires some manual looping over `nsmall`).
Hello!
I've been trying to scale my axis, that goes from 0 to 1.2M. Ideally, I would like to get numbers below 1M with K (and no decimals) but numbers above with one decimal (that is, 1.0M, 1.2M)
When I try default
![image](https://user-images.githubusercontent.com/12885915/78111039-59934d00-73fc-11ea-8ca8-7fd9175dfd7f.png)
accuracy
, I may get confused by numbers above 1M:demo_continuous(c(1, 1.2e6), label = label_number_si())
But if I change accuracy, then I get decimals too for numbers below 1M:
demo_continuous(c(1, 1.2e6), label = label_number_si(0.1))
It would be awesome to have some parameters to control this kind of options.
Thanks!
The text was updated successfully, but these errors were encountered: