search for: rel_hum

Displaying 3 results from an estimated 3 matches for "rel_hum".

2017 Oct 12
2
dual y-axis for ggplot
...onvenience, I copied the codes as follows. ######## p <- ggplot(obs, aes(x = Timestamp)) p <- p + geom_line(aes(y = air_temp, colour = "Temperature")) # adding the relative humidity data, transformed to match roughly the range of the temperature p <- p + geom_line(aes(y = rel_hum/5, colour = "Humidity")) # now adding the secondary axis, following the example in the help file ?scale_y_continuous # and, very important, reverting the above transformation p <- p + scale_y_continuous(sec.axis = sec_axis(~.*5, name = "Relative humidity [%]")) # mo...
2017 Oct 12
1
dual y-axis for ggplot
Hi John, You can try the following: override.linetype=c("twodash","solid") p <- ggplot(obs, aes(x = Timestamp)) p <- p + geom_line(aes(y = air_temp, colour = "Temperature", linetype ="Temperature")) p <- p + geom_line(aes(y = rel_hum/5, colour = "Humidity", linetype="Humidity")) p <- p + guides(colour=guide_legend(override.aes=list(linetype=override.linetype))) p <- p + scale_colour_manual(values = c("blue", "red")) p <- p + scale_linetype_manual(values = c("twodash", &...
2017 Oct 12
0
dual y-axis for ggplot
Sorry let me clarify. If I modify the line p <- p + geom_line(aes(y = air_temp, colour = "Temperature")) by p <- p + geom_line(aes(y = air_temp, colour = "Temperature", linetype ="Temperature")) and p <- p + geom_line(aes(y = rel_hum/5, colour = "Humidity")) by p <- p + geom_line(aes(y = rel_hum/5, colour = "Humidity", linetype="Humidity")) and p <- p + scale_linetype_manual(values = c("twodash", "solid")), I will have two lines with different color and different line typ...