Closed
Description
@teunbrand @thomasp85 This bug breaks unit tests in 'ggpp', but I can reproduce the bug using 'ggplot2' on its own.
The first example below used to work without error in 'ggplot2' (==3.4.4.9000) until quite recently (or at least 'ggpp' tests worked), but is now broken. Based on the second and third examples below, it seems that the combined use of the size
aesthetic and hjust = "right"
is what triggers the error.
With the current version here at GitHub I see:
library(ggplot2)
packageVersion("ggplot2")
#> [1] '3.4.4.9000'
packageDate("ggplot2")
#> [1] "2023-12-24"
mycars <- mtcars
mycars$name <- rownames(mycars)
ggplot(mycars, aes(wt, mpg, label = name)) +
geom_text(aes(size = wt), nudge_x = -0.1, hjust = "right")
#> Error in 1 - hjust[is_case]: non-numeric argument to binary operator
ggplot(mycars, aes(wt, mpg, label = name)) +
geom_text(nudge_x = -0.1, hjust = "right")
ggplot(mycars, aes(wt, mpg, label = name)) +
geom_text(aes(size = wt), nudge_x = -0.1, hjust = 1)
Created on 2023-12-25 with reprex v2.0.2
Metadata
Metadata
Assignees
Labels
No labels