i want to plot multiple plots, where in each plot i have observations of a set variable for different time sets in function of a distance
short example of my df:
year <- c("2018","2018","2018","2018","2019","2019","2019","2019")
polutatnt <- c("NO2","NO2","SO2","SO2","NO2","NO2","SO2","SO2")
radius <- c("500m", "1000m","500m", "1000m","500m", "1000m","500m", "1000m")
value <- c(0.5,0.8,0.1,-0.2,0.3,-0.6,0.2,-0.2)
df <- data.frame(year,polutatnt,radius,value)
i would like to have one plot for each polutant, where i would have one line for each year in function of distance. i tried this line of code but i get a waring and empty plots:
ggplot(df, aes(radius, value, col = year)) +
geom_line() + facet_grid(polutatnt ~.)
geom_path: Each group consists of only one observation. Do you need to adjust the group aesthetic?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.