View source: R/dw_create_symbol_map.R
dw_create_symbol_map | R Documentation |
experimental Creates and returns a new Datawrapper Symbol map object. This function starts the map-making process
dw_create_symbol_map(
basemap_id,
lat_col,
lon_col,
color_col = "",
size_col = "",
shape = "",
api_key = "environment",
title = "",
tooltip = list(title, body, fields = c()),
folderId = ""
)
basemap_id |
Required. Can be retrieved by looking at |
lat_col |
Required. Which column contains the Latitude values to be plotted on the map? |
lon_col |
Required. Which column contains the Latitude values to be plotted on the map? |
color_col |
Optional. Which column contains the values that should determine the color. |
size_col |
Optional. Which column contains the values that should determine the size. |
shape |
Optional. Select a shape. Defaults to circle. |
api_key |
Required. A Datawrapper-API-key as character string. Defaults to "environment" - tries to automatically retrieve the key that's stored in the .Reviron-file by |
title |
Optional. Will set a map's title on creation. |
tooltip |
Optional. Specify a list including these vectors: |
folderId |
Optional. Creates chart in specified folder. |
It prints the new chart's id and returns a S3-structure of type dw_chart with the elements from the Datawrapper-API, the same as in dw_retrieve_chart_metadata
. After creating the chart you can populate and update it with dw_data_to_metadata
If not specified, the new chart will by default be created without a title.
Benedict Witzenberger
## Simple example:
## Not run:
dw_create_symbol_map(
basemap_id = "world-2019",
basemap_value = "DW_STATE_CODE",
lat_col = "LAT",
lon_col = "LONG"
)
## Include a tooltip:
dw_create_choropleth_map(
basemap_id = "world-2019",
basemap_value = "DW_STATE_CODE",
value_cols = "percentage",
key_cols = "iso_codes",
tooltip = list(
title = "{{ State_Name }}",
body = "In {{ State_Name }} the value is {{percentage}} percent.",
fields = c("State_Name", "percentage")
))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.