简体中文 | English
knitr::opts_chunk$set( fig.path = "man/figures/", message = FALSE )
ncov 疫情图,参考ncovr, 具体使用详情见vignette. 暂放于此,后续可并入ncovr
数据获取通过DXY-COVID-19-Crawler
api 下载,调用get_ncov()
即可获取。
if (!require(remotes)) install.packages("remotes") if (!require(ncovmap)) remotes::install_github("yiluheihei/ncovmap")
library(ncovmap) library(leafletCN)
ncov <- get_ncov2(method = "api") ncov
# 中国数据 china <- ncov['china'] china # 省市数据 hubei <- ncov['湖北省'] hubei beijing <- ncov['北京市'] beijing beijing$cities # 世界数据 world <- ncov['world'] world
plot_china_map(china, legend_position = "bottomleft")
湖北省
plot_province_map( hubei, "湖北省", bins = c(0, 100, 200, 500, 1000, 10000) )
北京市
plot_province_map( beijing, "北京市", bins = c(0, 10, 50, 100) )
plot_world_map(world, legend_position = "bottomleft")
korea_ncov <- get_foreign_ncov("韩国") plot_foreign_map(korea_ncov, "korea")
jp_ncov <- get_foreign_ncov("日本") plot_foreign_map(jp_ncov, "japan")
iran_ncov <- get_foreign_ncov("伊朗") plot_foreign_map(iran_ncov, "iran")
italy_ncov <- get_foreign_ncov("意大利") plot_foreign_map(italy_ncov, "italy")
foreign_countries <- c("韩国", "伊朗", "日本", "意大利") names(foreign_countries) <- c("korea", "iran", "japan", "italy") htmltools::tagList(purrr::imap( foreign_countries, ~ get_foreign_ncov(.x) %>% plot_foreign_map(.y) ))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.