Description Usage Arguments Examples
View source: R/provincepoint.R
provincepoint function provides a simple way to mark points on Chinese province map.
1 2 3 4 5 6 7 8 9 10 11 12 13 | provincepoint(cat, name, lat, lon, region = "anhui",
theme = "sandsignika", title = "Example Map",
titleAlign = "center", titleSize = "20px", titleColor = "#333333",
subtitle = "", subtitleAlign = "center", subtitleSize = "",
subtitleColor = "#666666", itermName = "Random data",
headerFormat = "<small>{point.key}</small><table>",
pointFormat = "<tr><td>Catagory: </td><td>: {series.name}</td></tr><tr><td>Location: </td><td>({point.lon:.2f}, {point.lat:.2f})</td></tr>",
footerFormat = "</table>", hoverColor = "#a4edba",
legendLayout = "horizontal", legendAlign = "center",
legendTitle = "", legendVerticalAlign = "bottom", markerRadius = 3,
mapNavigation = 1, mapNavigationVerticalAlign = "bottom",
mapNavigationAlign = "left", width = NULL, height = NULL,
elementId = NULL)
|
cat |
category vector; |
name |
name vector; |
lat |
latitude vector; |
lon |
longitude vector; |
region |
A pinyi character, "anhui", "aomen", "beijing", "chongqing", "fujian", "gansu", "guangdong", "guangxi", "guizhou", "hainan", "hebei", "heilongjiang", "henan", "hubei", "hunan", "jiangsu", "jiangxi", "jilin", "liaoning", "neimenggu", "ningxia", "qinghai", "shandong", "shanghai", "shanxi", "shanxi2", "sichuan", "tianjin", "xianggang", "xinjiang", "xizang", "yunnan", "zhejiang". |
theme |
Chart theme, you can choose one from: darkgreen/darkblue/avocado/darkunica/gray/ gridlight/grid/sandsignika/sunset; |
title |
Chart title; |
titleAlign |
The horizontal position of the title, such as "center"; |
titleSize |
The size of the title, such as "20px"; |
titleColor |
The color of the title, such as "#3333"; |
subtitle |
Subtitle of chart; |
subtitleAlign |
The horizontal position of subtitles, such as "center"; |
subtitleSize |
The size of the subtitle, such as "16px"; |
subtitleColor |
The color of the subtitle, such as "#666666"; |
itermName |
Data attributes in tooltip; |
headerFormat |
Header format, default value is '<small>point.key</small><table>'; |
pointFormat |
Point format, default value is "<tr><td>Catagory: </td><td>: series.name </td></tr><tr><td>Location: </td><td>(point.lon:.2f, point.lat:.2f)</td></tr>"; |
footerFormat |
Footer format, default value is '</table>'; |
hoverColor |
The color of the area when the mouse is hovering. |
legendLayout |
Legend, horizontal or vertical; |
legendAlign |
Horizontal position of legend, center/left/right; |
legendTitle |
The title of the legend; |
legendVerticalAlign |
The vertical position of legends, top/center/bottom; |
markerRadius |
Marker Radius; |
mapNavigation |
show map navigation or not, 1 means show, 0 means not; |
mapNavigationVerticalAlign |
Map navigation vertical align, top/bottom; |
mapNavigationAlign |
map navigation align, center/left/right; |
width |
Chart width; |
height |
Chart height; |
elementId |
NULL. |
1 2 3 4 5 6 7 8 9 10 11 12 13 | library(hchinamap)
library(dplyr)
library(magrittr)
dir <- tempdir()
download.file('https://czxb.github.io/br/chinamappointdf.rda', file.path(dir, 'chinamappointdf.rda'))
load(file.path(dir, 'chinamappointdf.rda'), verbose = TRUE)
df <- chinamappointdf %>% dplyr::filter(province == "Shandong")
if(interactive()) {
provincepoint(cat = df$cat, name = df$name,
lat = df$lat, lon = df$lon, region = "shandong",
title = "Urban distribution in Shandong Province",
subtitle = "Data source: People's daily")
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.