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

Function retrieved from label_number(scale_cut = cut_short_scale()) fails #488

Open
lschneiderbauer opened this issue Jan 28, 2025 · 1 comment

Comments

@lschneiderbauer
Copy link

I am not sure this package is meant to be used outside the context of 'ggplot2', but I was simply looking for a function that converted my numbers in a nice human readable fashion, and scales seems to provide just that.

However, the function seems to fail in certain conditions:

library(scales)

conv_label <- label_number(scale_cut = cut_short_scale())

y <- c(1460.6155, 848.2228, 572.0146)
conv_label(y)
#> [1] "1K"  "848" "572"

x <- c(1460.6155, 848.2228, 572.0146, 1014.9259)
conv_label(x)
#> Error in break_suffix[bad_break][improved_break & !power10_break] <- names(lower_break[improved_break & : NAs nicht zugelassen in Teilbereichszuweisungen

Created on 2025-01-28 with reprex v2.1.1

There is no obvious reason to me why it should not work for the second example.
I am using scales 1.3.0.

@teunbrand
Copy link
Contributor

Hi there thanks for the report! I think this is a duplicate of #413, which is already fixed in the development version

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

2 participants