Hi I want to show in the same graph a barplot and a line. They have the same x axis but different y axis.
Just the barplot looks like this:
and when I use this:
ggplot()+ geom_line(data=avdischarge, aes(x= monthyr, y= Avdischarge))+
geom_bar(data= melt, aes(x=monthyr, y= value, fill= Compound ), stat= "identity")+
scale_y_continuous("Average discharge", sec.axis = sec_axis(~./100, name = "Concentration"))
I get this plot:
What can I do so the barplot appears as the first picture? and not like a tiny thing below the geom_line?
Also, How can I add just the legend of the line?