dotAW <- A_W_point
dotAW <- ggplot(dotAW,aes(x=AASW, y=WW, fill=taxa))
dotAW <- dotAW + geom_jitter(aes(color = taxa), size = 4)
dotAW <- dotAW +geom_abline(intercept = 0, slope = 1)
dotAW <- dotAW + scale_y_continuous(limits=c(0,0.5)) + scale_x_continuous(limits=c(0,0.5))
dotAW
ggsave(dotAW, file="dotAW.pdf", width=12, height=10)
With this plot I want to correlate relative abundance of bacterial taxa. I have some issues to solve, where I need help
here is a link to the data: https://docs.google.com/spreadsheets/d/1w5gHoWjFsgUUXEZOv9PTKfRQ-GyMkqulpAFVJaiX1K8/edit?gid=0#gid=0
With geom_jitter
the point are plotted in their exact location, but somewhat besides that (above/below and/or right/left).
I've put your data in a dataframe df
. Then you can create your plot with:
dotAW <- ggplot(df,aes(x=AASW, y=WW, color=taxa)) +
geom_point(shape = 20, size = 4, position = "jitter") +
geom_abline(intercept = 0, slope = 1) +
scale_y_continuous(limits=c(-0.05,0.5)) +
scale_x_continuous(limits=c(-0.05,0.5)) +
scale_color_hue()
dotAW
which gives the following result:
You can set the colors manually with scale_color_manual()
like this:
scale_color_manual(values = c("Flavobacteriaceae"="red", "Oceanospirillales"="blue", "Gammaproteobacteria" = "green"))