Boxplot not showing up on plot area

Plot shows up on R studio cloud website but not when I download it on my computer and try to see it on the computer R studio. R studio on both is fully updated.
Here is my R script:

set.seed(65062123)
df <- data.frame(
treatment=factor(rep(c("Control", "Intervention"), each=50)),
measurement=round(c(rnorm(50, mean=55, sd=3),
rnorm(50, mean=68, sd=3)))
)

library(ggplot2)

p<- ggplot(df, aes(x=treatment, y=measurement))+
geom_boxplot()+ labs(y= "Age (years)")+
geom_jitter(aes(color = treatment))+
theme(legend.position = "none")

1 Like

Hi @sdmasingil, like you save the plot in p

you need run p

set.seed(65062123)
df <- data.frame(
treatment=factor(rep(c("Control", "Intervention"), each=50)),
measurement=round(c(rnorm(50, mean=55, sd=3),
rnorm(50, mean=68, sd=3)))
)

library(ggplot2)

p<- ggplot(df, aes(x=treatment, y=measurement))+
geom_boxplot()+ labs(y= "Age (years)")+
geom_jitter(aes(color = treatment))+
theme(legend.position = "none")

p # you forgot this little part

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.