Skip to content

Instantly share code, notes, and snippets.

@gtgrthrst
Created May 9, 2021 02:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gtgrthrst/121e103e3d43718e74817fe8c1ea6bef to your computer and use it in GitHub Desktop.
Save gtgrthrst/121e103e3d43718e74817fe8c1ea6bef to your computer and use it in GitHub Desktop.
library(ggplot2)
library(jsonlite)
library(dplyr)
aqi<-fromJSON("https://data.epa.gov.tw/api/v1/aqx_p_138?offset=1&limit=100000&api_key=71c8c657-ddd3-44b6-a6c1-8e5a712a42df")
str(aqi)
temp2.5<-filter(aqi[[6]],ItemEngName=="PM2.5")
str(temp2.5)
ggplot(temp2.5, mapping = aes(x = as.POSIXct(MonitorDate,format="%Y-%m-%d %H:%M:%S"),
y = as.numeric(Concentration),colour = SiteName))+
geom_line() +
theme(axis.title=element_blank(),
axis.text=element_blank(),
axis.ticks=element_blank()
) + #刪除XY軸
guides(fill = FALSE, color = FALSE, linetype = FALSE, shape = FALSE) #刪除圖例
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment