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

fix bug in label_number when scale_cut argument is provided (#413) #420

Merged
merged 1 commit into from
Oct 21, 2024

Conversation

colindouglas
Copy link
Contributor

This pull request resolves #413, implementing the fix proposed by @jbengler (link)

Behaviour in 1.3.0:

> scales::label_number(scale_cut = scales::cut_short_scale())(c(0,500,1500,2000,2500))
Error in break_suffix[bad_break][improved_break & !power10_break] <- names(lower_break[improved_break &  : 
  NAs are not allowed in subscripted assignments

Behaviour after change (as expected):

> scales::label_number(scale_cut = scales::cut_short_scale())(c(0,500,1500,2000,2500))
[1] "0"    "500"  "1.5K" "2.0K" "2.5K"

This change does not break any package tests, and I have added an additional test against this behaviour.

[ FAIL 0 | WARN 0 | SKIP 0 | PASS 597 ]

@jeffrey-parmet
Copy link

What's the status on this? Still seeing this problem and the workaround to revert to 1.2.1 isn't working for me.

@joranE
Copy link

joranE commented Apr 15, 2024

I am also curious what the status of this PR is, as I run into this issue daily.

@teunbrand
Copy link
Contributor

If you're in need of this PR now, you can use pak::pak("https://github.com/r-lib/scales/pull/420") to install it.

@markram4
Copy link

markram4 commented Jun 3, 2024

I'm still seeing this error when I try scale_y_continuous(labels=scales::label_number(scale_cut = cut_short_scale())). I can't go back to 1.2.1 and I tried the suggestion by teunbrand to no success

@slowkow
Copy link

slowkow commented Aug 13, 2024

I am still running into this same issue.

Thanks to @teunbrand for the fix! It works for me.

@teunbrand
Copy link
Contributor

Please pass on any and all thanks to Colin, I'm just the middleperson giving installation hints :)

@MarkMc1089
Copy link

I'm still seeing this error when I try scale_y_continuous(labels=scales::label_number(scale_cut = cut_short_scale())). I can't go back to 1.2.1 and I tried the suggestion by teunbrand to no success

Also not fixed for me when installing from this PR.

@thomasp85 thomasp85 merged commit 6f2f979 into r-lib:main Oct 21, 2024
12 checks passed
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

Successfully merging this pull request may close these issues.

label_number error when including scale_cut argument
8 participants