this is a heads up that your code is breaking with the upcoming ggplot2 3.3.1 release (https://github.com/tidyverse/ggplot2/issues/3871#issuecomment-633419085). This is due to changes in stat_function() that now make it more sensitive to certain bad programming patterns, such as feeding in data via the aes() function.
You can generally fix the issue by feeding in the data via the data argument rather than via aes():
library(ggplot2)
x <- rnorm(100)
# bad
ggplot() +
aes(x) +
geom_density(color = "blue") +
stat_function(fun = dnorm)
#> Error: Aesthetics must be either length 1 or the same as the data (1): x
# good
ggplot(data.frame(x)) +
aes(x) +
geom_density(color = "blue") +
stat_function(fun = dnorm)
Hello,
this is a heads up that your code is breaking with the upcoming ggplot2 3.3.1 release (https://github.com/tidyverse/ggplot2/issues/3871#issuecomment-633419085). This is due to changes in
stat_function()
that now make it more sensitive to certain bad programming patterns, such as feeding in data via theaes()
function.The code at issue is code such as the following: https://github.com/ibecav/CGPfunctions/blob/62efdb6bff0aefb598c59bfbdda86052add5e1c0/R/seedist.R#L262-L271
You can generally fix the issue by feeding in the data via the
data
argument rather than viaaes()
:Created on 2020-05-25 by the reprex package (v0.3.0)
If you encounter any problems fixing these issues, I'm happy to help.