Description Usage Arguments Value
View source: R/viz_functions.R
Create a choropleth map for Italian provinces based on continuous input data by province
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
province_sf |
[sf] Spatial object of provinces. Should have a 'location_code' field that will be matched to data |
region_sf |
[sf] Spatial object of regions. Will be added as an outline to map |
in_data |
[data.table] Dataset to be plotted. Should only include one row of data per province |
map_field |
[char] Field in 'in_data' to be mapped |
fill_list |
list of fill parameters that should be used, in the format of arguments to the 'scale_fill_<fill_type>' |
fill_lims |
[numeric, default NULL] Vector of upper and lower values for color scale. |
titles_list |
[default empty list] list of any titles that should be included, in the format of arguments to the ggplot 'labs' command |
fill_type |
[optional, default 'continuous'] Scale fill type eg. 'discrete' or 'continuous' |
show_legend |
Should the legend be featured on the plot? |
labels_dt |
[optional] Data.table used to label locations on the graph. Should be a data.table containing at least the fields 'label_name', 'x', 'y', 'x1_lseg', 'x2_lseg', 'y1_lseg', 'y2_lseg' |
save_fp |
[optional, default NULL] if not NULL (the default), saves to file rather than returning an object. If filled, should be a PNG extension |
file_height |
[optional, default 8] map height in inches |
file_width |
[optional, default 6] map width in inches |
Either returns a ggplot object or, if 'save_fp' is not NULL, saves to file and returns NULL
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.