I have multiple, large sets of data that changes over time. I am subsetting them and graphing them on a 0 - 24 hour time scale, with each day of the week getting a different shade of the same color using colorbrewer - see the attached graphs.
I would like to combine two of these graphs and maintain their original color brewer shades. To graph each dataset individually I have been doing the following:
pb <- ggplot(PBSub2, aes(x= STH, y = pH, group = Day, color = Day)) +
geom_line(size=1)+
theme_dark()+
ggtitle("TITLE")+
xlab("Standing time (hours)")+
scale_x_continuous(breaks=c(0,4,8,12,16,20,24))+
scale_y_continuous(limits = c(6,8))
pb + scale_color_brewer(,,palette = "Reds")
p<- ggplot(WISub1, aes(x= STH, y = pH, group = Day, color = Day)) +
geom_line(size=1)+
theme_dark()+
ggtitle("TITLE")+
xlab("Standing time (hours)")+
scale_x_continuous(breaks=c(0,4,8,12,16,20,24))+
scale_y_continuous(limits = c(6,8))
p + scale_color_brewer(,,palette = "Blues")
I figured out how to combine the data into the same graph, with the following code, but I cannot figure out how to separate them into their original "Reds" and "Blues" colors:
ggplot(NULL, aes(x= STH, y = pH, group = Day, color = Day)) +
geom_line(data=WISub1, size=1, color = WISub1$Day)+
scale_color_brewer(,,palette = "Blues")+
geom_line(data=PBSub2, size=1, color = PBSub2$Day)+
scale_color_brewer(,,palette = 'Reds')+
theme_dark()+
ggtitle("TITLE")+
xlab("Standing time (hours)")+
scale_x_continuous(breaks=c(0,4,8,12,16,20,24))+
scale_y_continuous(limits = c(6,8))
The second "scale_color_brewer" overrides the first instead of only applying to the second element. Should I manually assign colors? Or is there an automatic way to assign the same colors?