-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Open
Description
I found a problem with ggplot2 4.0.0 which generate broken result when using transformed coord with annotation_custom(grob)
Here is the code to reproduce the bug:
library(ggplot2)
library(grid)
df <- data.frame(x = 1:10, y = 1:10)
ggplot(df, aes(x = x, y = y)) +
geom_point() +
scale_y_continuous("y", expand = c(0.1, 0.1), transform = "log10") +
annotation_custom(
grob = grid::textGrob("some text",
x = unit(0.5, "npc"),
y = unit(0.9, "npc"),
gp = grid::gpar(fontsize = 12)
)
)The behavior in 3.5.0 was expected:

But I got this in 4.0.0:

with warning:
In log(x, base) : NaNs produced
I guess the problem was that the transform was wrongly applied to the grob.
Metadata
Metadata
Assignees
Labels
No labels