I would like to make a mean with with confidence interval on my ggplot. I have actually made a mean graph, but it is plotted as a graph the same way as the others, so i don't know, if it is possible to get a confidence interval on it. Anyone that can help?
DNAMorfR %>%
drop_na(`Normal morphology (%)`) %>%
ggplot(aes(x = Time, y = `Normal morphology (%)`, linetype = Patient, color = Patient, group = Patient, na.rm = TRUE)) +
geom_line(size = 1) +
theme_minimal() + ggtitle("(A1) Normal morphology") +
geom_point(size = 1.5) +
scale_y_continuous(limits = c(0, 25), breaks=seq(0, 25, by = 5)) +
geom_hline(yintercept = 4, color = "grey", size = 1) +
scale_color_manual(values = c("black", "#FF3333", "#FF9933", "#CC9900", "#FF33FF", "cyan", "#99FF33", "#339933", "#0000CC", "#6699FF", "#CCFFFF")) +
Hi!
To help us help you, could you please prepare a repr oducible ex ample (reprex) illustrating your issue? Please have a look at this guide, to see how to create one:
A minimal reproducible example consists of the following items:
A minimal dataset, necessary to reproduce the issue
The minimal runnable code necessary to reproduce the issue, which can be run
on the given dataset, and including the necessary information on the used packages.
Let's quickly go over each one of these with examples:
Minimal Dataset (Sample Data)
You need to provide a data frame that is small enough to be (reasonably) pasted on a post, but big enough to reproduce your issue.
Let's say, as an example, that you are working with the iris data frame
head(iris)
#> Sepal.Length Sepal.Width Petal.Length Petal.Width Species
#> 1 5.1 3.5 1.4 0.…
I don't know exactly how to upload the data best. Can it be used like this?:
|Time|Patient|Normal morphology (%)|
|Week 1|1|7,00|
|Week 2|1|2,00|
|Week 3|1|3,00|
|Week 1|2|1,00|
|Week 2|2|3,00|
|Week 3|2|3,00|
|Week 1|3|6,00|
|Week 2|3|7,00|
|Week 3|3|8,00|
The article I shared with you is a lesson on how to share.
Please try again?
Now it should be correct i think:
datapasta::df_paste(head(DNAMorfR, 9)[, c('Time', 'Patient', 'Normal morphology (%)')])
data.frame(
Patient = c("1","1","1","2","2","2","3","3","3"),
Normal morphology (%)
= c(7, 2, 3, 1, 3, 3, 6, 7, 8),
Time = as.factor(c("Week 1","Week 2","Week 3","Week 1",
"Week 2","Week3 ","Week 1","Week 2",
"Week 3")))
I think you duplicated this in a more recent post. But ok. Think about how the values to plot are to come from ? You need to calculate them in some way. They don't currently exist to be plotted.
system
Closed
July 5, 2021, 8:15pm
8
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.