'Is the R function for dividing dual y(mutiple) in time-series graph?
I'm trying to plot graph that dual y according to concentration(ppm, temperature etc.)
Reference data is here.
Using this data, i want to make graph below.
In terms of dividing physical unit like "concentration, Celsius", i moved "Gas.temp" to right y axis. I used library 'ggplot', 'openair', but couldn't find any related function what i want plot because lack of knowledge.
In summary, point is, how to move "Gas.temp" to right y axis in the multiple time-series graph in R.
Thank you so much..!
Solution 1:[1]
I think the geom_ts()
from FOQAT
package is an easy way. Please try this exmaple:
library(foqat)
head(aqi)
geom_ts(
df=aqi,
yl=4, yr=6,
llist=c(4, 6),
yllab=bquote(NO[2]~" "~(ppbv)), yrlab=bquote(O[3]~" "~(ppbv)), xlab="Datetime",
llab=list(bquote(NO[2]~" "), bquote(O[3]~" ")),
lcc=c("#096dd9","#ff4d4f"),
ana=FALSE
)
# Time NO NO2 CO SO2 O3
#1 2017-05-01 01:00:00 0.0376578 2.79326 0.256900 NA 56.5088
#2 2017-05-01 01:01:00 0.0341483 2.76094 0.254692 NA 57.0546
#3 2017-05-01 01:02:00 0.0310285 2.65239 0.265178 NA 57.6654
#4 2017-05-01 01:03:00 0.0357016 2.60257 0.269691 NA 58.7863
#5 2017-05-01 01:04:00 0.0337507 2.59527 0.273395 NA 59.0342
#6 2017-05-01 01:05:00 0.0238120 2.57260 0.276464 NA 59.2240
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | TichPi |