goodmap | R Documentation |
goodmap
function is designed to create interactive PNG Map or GIF Map from a provided data file.
It supports two types of maps: point
and polygon
.
The function can visualize data by either plotting points based on geographical coordinates
or highlighting regions polygon based on their administrative boundaries (province or city level).
Additionally, the function can generate animated that showcase the change of data.If the map type is point
, the color and size of the points will be determined by the
value_set
column in the data file, which means the different value of each point.
If the map type is polygon
, the color of the polygons will be determined by the average
value of the value_set
column for each city or province in the data file.
goodmap(
data_file,
type = "point",
level = NULL,
animate = FALSE,
animate_var = NULL,
map_center = c(35.8617, 104.1954),
zoom_level = 4,
color_type = "numeric",
custom_colors = NULL,
point_radius = 5,
legend_opacity = 0.7,
legend_name = NULL,
width = 800,
height = 900
)
data_file |
Dataframe.
When generate point map, |
type |
A string specifying the type of map to generate. Options are |
level |
A string specifying the level of administrative boundaries for polygon maps.
Acceptable values are |
animate |
A logical value indicating whether to generate an animation from the maps. The default is FALSE. If animate is FALSE, the whole data will be generated as a PNG file. If animate is TRUE, an animation will be generated from all panel data, the animate_var must be assigned. |
animate_var |
A string specifying the variable to animate over.
The default is |
map_center |
A numeric vector of length 2 specifying the latitude and longitude
for the center of the map view. Default is |
zoom_level |
A numeric value specifying the zoom level for the map. Default is 3. |
color_type |
If the data is discrete, such as types or categories, choose |
custom_colors |
A vector of colors for customizing the color gradient. Default is |
point_radius |
A numeric value specifying the radius for point markers on point maps. Default is 5. |
legend_opacity |
A numeric value specifying the opacity of the legend. Default is 0.7. |
legend_name |
The name of the legend. Default is |
width |
A numeric value specifying the width of the map images. Default is 800. |
height |
A numeric value specifying the height of the map images. Default is 900. |
Image in the viewer.
goodmap(
toy_poly,
type = "polygon",
level = "province"
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.