Hello, I'm struggling doing a plot with R and I didn't find an answer, so I post it here and if you know the answer or a post with the answer it would be really helpful.
I want a barplot with error bars, and with a dot plot with the values of every single replicate stacked by target and sample, but I want the dots with a different shape for each biological replicate
What I want is a graph like the second one but with the dots shaped like in the first one, I tried different options but I still dont get the result I want. Here it is my code:
ggplot(summ, aes(x = TARGET, y = value, fill = factor(SAMPLE, levels=c("Ctrl", "si")))) +
geom_bar(position = position_dodge(), stat = "identity", colour = "black", width = .9) +
geom_errorbar(aes(ymin=value-sd, ymax=value+sd), width=.2,
position=position_dodge(.9)) + theme_minimal() +
scale_fill_manual(values = c("#CCCCCC", "#FFFFFF")) +
ggtitle("G30") +
theme(axis.title.x = element_blank()) + ylab("Fold Change\n") +
#scale_x_discrete("TARGET", limits = c()) +
guides(fill = guide_legend(title = NULL)) +
geom_jitter(data = dt, aes( x = TARGET, y =value,
fill =factor(SAMPLE, levels=c("Ctrl", "si"))),
#shape = variable),
position = position_dodge(width = 0.9), stat = "identity")
And here an example of my input:
TARGET SAMPLE variable value
a Ctrl REPL.1 0.8435998
a si REPL.1 0.7391897
b Ctrl REPL.1 0.7636603
b si REPL.1 0.7921603
c Ctrl REPL.1 0.4640940
c si REPL.1 0.3322137
Thank you!
Look up
scale_shape_manual()
I already have tried, as well as scale_shape_identity, still nothing :(