I am wondering how it is possible to make a barplot where my data will be showed on opposite sides of the x-axis with two different y-axis?
I have two processes that go in different directions (one in + that need to go upwards and one in - that goes downward) all dates will each have one of each if that makes sense
It needs to look somewhat like this: Ravn, N. R. (2017)
GEP.2015.plot <- ggplot(Salix_data.2015,aes(x = Flux_Date, y = GEP, fill = Treatment))
GEP.2015.bar <- (GEP.2015.plot+
stat_summary(fun=mean,geom="bar", position="dodge", width =0.8)+
stat_summary(fun.data = mean_se, geom = "errorbar",
width=0.2, position = position_dodge(0.8))+
theme(legend.position = "bottom")+
annotate(geom = "text", x = 1, y = -20000, label = "a")+
annotate(geom = "text", x = 2, y = -12000, label = "b")+
annotate(geom = "text", x = 3, y = -17000, label = "a")+
annotate(geom = "text", x = 4, y = -10000, label = "a")+
annotate(geom = "text", x = 3, y = -19000, label = "*")+
labs(title = "GEP by Date and Treatment in Salix arctica heath in 2015", x="Date",y="GEP"))
ER.2015.plot <- ggplot(Salix_data.2015,aes(x = Flux_Date, y = ER, fill = Treatment))
ER.2015.bar <- (ER.2015.plot+
stat_summary(fun=mean,geom="bar", position="dodge", width =0.8)+
stat_summary(fun.data = mean_se, geom = "errorbar",
width=0.2, position = position_dodge(0.8))+
theme(legend.position = "bottom")+
annotate(geom = "text", x = 1, y = 8000, label = "a")+
annotate(geom = "text", x = 2, y = 5000, label = "a")+
annotate(geom = "text", x = 3, y = 7500, label = "b")+
annotate(geom = "text", x = 3, y = 8000, label = "*")+
annotate(geom = "text", x = 4, y = 3000, label = "a")+
labs(title = "ER by Date and Treatment in Salix arctica heath in 2015", x="Date",y="ER"))
At the moment I have two separate plots. I would like to have them in the same plot with GEP in the negative y-axis, pointing down, and the ER in the positive Y-axis pointing up.