Date | Mn | Fe |
---|---|---|
2013-01-13 | 67.7 | 1990 |
2014-01-13 | 60.8 | 2082 |
2015-01-13 | 57.1 | 3901 |
2016-01-13 | 40.8 | 7022 |
2017-01-13 | 30.8 | 5063 |
2018-01-13 | 50.3 | 2032 |
2019-01-13 | 20.8 | 6225 |
2020-01-13 | 43.1 | 8853 |
2021-01-13 | 53.8 | 4048 |
2022-01-13 | 33.1 | 6238 |
When I make the plot (code below), the Mn-line appears as a straight line compared with the Fe-line. It is because of the low Mn values. I was wondering if anyone could help me to create two independent Y axis in a single plot so that both Fe and Mn could represent their pattern independent of each other along the same X-axis.
t<- ggplot(data = stack.data, aes(x= Date)) +
geom_line(aes (y = Mn,color = "Mn"), size = 1.4) +
geom_line(aes (y = Fe, color = "Fe"), size = 1.4) +
scale_y_continuous(name = "Mn",
sec.axis = sec_axis(trans = ~.*10, name="Fe"))+
scale_color_manual("", values = c( "#F8766D", "#00BFC4")) +
theme_bw()+
theme(legend.position="top")
t