Created
March 11, 2021 23:14
-
-
Save aurielfournier/a52265e4e7becea26073bb5704c27419 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(ggplot2) | |
dat1 <- data.frame(y=c(1,2,3,4,5), | |
x=c("a","b","c","d","f")) | |
dat2 <- data.frame(y=c(1,2,3,4,5), | |
x=c("b","c","d","e","f")) | |
plot1 <- ggplot(dat=dat1, | |
aes(x=x, y=y, color=x))+ | |
geom_point()+ | |
# this code below here is the same in both graphs | |
scale_color_manual(breaks=c("a","b","c","d","e","f"), # so this is all the bacteria groups, across all the graphs | |
values=c("red","orange", | |
"yellow","green", | |
"blue","purple")) # and this is their colors | |
plot2 <- ggplot(data=dat2, | |
aes(x=x, y=y, color=x))+ | |
geom_point()+ | |
scale_color_manual(breaks=c("a","b","c","d","e","f"), | |
values=c("red","orange", | |
"yellow","green", | |
"blue","purple")) |
Author
aurielfournier
commented
Mar 11, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment