Displaying 5 results from an estimated 5 matches for "after_stat".
Did you mean:
afr_stat
2024 Aug 11
1
geom_smooth with sd
Dear community
Using after_stat() I was able to visualise ggplot with standard deviations
instead of a confidence interval as seen in the R help.
p1<-ggplot(data = MS1, aes(x= Jahr, y= QI_A,color=Bio, linetype=Bio)) +
geom_smooth(aes(fill=Bio,
ymax=after_stat(y+se*sqrt(length(y))), ymin=after_stat(y-se*sq...
2024 Aug 11
1
geom_smooth with sd
...ses sqrt(y), while the second uses sqrt(length(y)).
Could that play a part, please?
Thank you
Erin Hodgess, PhD
mailto: erinm.hodgess at gmail.com
On Sun, Aug 11, 2024 at 10:10?AM SIBYLLE ST?CKLI via R-help <
r-help at r-project.org> wrote:
> Dear community
>
>
>
> Using after_stat() I was able to visualise ggplot with standard deviations
> instead of a confidence interval as seen in the R help.
>
>
>
> p1<-ggplot(data = MS1, aes(x= Jahr, y= QI_A,color=Bio, linetype=Bio)) +
>
> geom_smooth(aes(fill=Bio,
> ymax=after_stat(y+se*sqrt(le...
2023 Jan 12
1
Reg: ggplot error
...ody would like to go through your whole code.
1. data seems to be read correctly
ICUData <- read.csv(file = "ICUData.csv", stringsAsFactors = TRUE)
ICUData.neuro <- ICUData[ICUData$surgery == "neuro",]
2. ggplot(ICUData, aes(x=ICUData.neuro$LOS)) +
geom_histogram(aes(y=after_stat(density)), binwidth = 5,
fill = "darkgrey")
gives me error
Error in `check_aesthetics()`:
! Aesthetics must be either length 1 or the same as the data (500): x
Run `]8;;rstudio:run:rlang::last_error()rlang::last_error()]8;;` to see where the error occurred.
which, I b...
2023 Aug 12
1
geom_smooth
...ribbon but I cannot figure this out. Some
> advice would be welcome.
This works for me:
ggplot(scatter_data,aes(x=x_var,y=y_var,))+
geom_point()+
geom_smooth(se=TRUE,fill="blue",color="black",linetype="dashed") +
geom_ribbon(stat="smooth", aes(ymin=after_stat(ymin), ymax=after_stat(ymax)), fill=NA, color="black")+
theme_cowplot()
Cheers,
Berwin
2023 Aug 12
2
geom_smooth
Colleagues,
Here is my reproducible code for a graph using geom_smooth
set.seed(55)
scatter_data <- tibble(x_var = runif(100, min = 0, max = 25)
?????????????????????? ,y_var = log2(x_var) + rnorm(100))
library(ggplot2)
library(cowplot)
ggplot(scatter_data,aes(x=x_var,y=y_var))+
? geom_point()+
? geom_smooth(se=TRUE,fill="blue",color="black",linetype="dashed")+