Description Usage Arguments Author(s) Examples
Creates surveillance chloropleth maps for data prepared with PrepMap. Note that due to the use of grid for legend and the small inlets for non-visible countries, mapping is not superswift and elements appear one by one to the graph. Also, the alignment of the legend, as well as fontsize depends on the width x height. Current ideal dimensions approximately 1000x680. Currently uses 'Arial' font, to be updated to 'Tahoma'.
1 2 3 | SurvMapper(data, fills, long = "long", lat = "lat", id = "id",
GEO_ID = "GEO_ID", bground = "isEEA", Legend_title, col_scale,
fill_levels = NULL, reverse_colours = FALSE)
|
data |
Your spatial data that you want to map, prepared to work with ggplot2, currently only chloropleth available |
fills |
Your column/variable(s) that your want to map. Preferably a factor in defined order. |
long |
Your longitude variable, defaults to 'long' |
lat |
Your latitude variable, defaults to 'lat' |
id |
Your spatial id variable, defaults to 'id' |
GEO_ID |
Your spatial id variable (e.g. country code), defaults to 'GEO_ID' |
bground |
Your variable with 1/0 to classify the grey background (0's included only in lightgrey), defaults to 'isEEA' |
Legend_title |
Legend title(s). More than one if more than one fills. |
col_scale |
Colour scale, use 'green', 'red', 'blue' or 'qualitative'. Note that the last category is always "No data" grey. More than one if more than one fills. |
fill_levels |
The order to map the levels in fills; only works with one fills variable. |
reverse_colours |
Reverse the order of the colour scale. Note that the last category is always "No data" grey. |
Tommi Karki
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | # load the included dummy data
load(system.file("extdata", "dummy_data.rds", package = "SurvMaps"))
# Get the EU/EEA and candidate country SpatialPolygonsDataframe, including a variable "isEEA"
plg_map <- get_GEO_data(layer = 1, STAT_LEVL = c(0), FIELDS = c("isEEA", "GEO_ID"))
# Prepare the data for SurvMapper with PrepMap
mymap <- PrepMap(data = dummy_data , geo = plg_map)
# The map is correctly aligned only for selected width/height, so you can plot into a predefined device
dev.new(width=11.8,height=8, noRStudioGD = TRUE)
# Simple chloropleth map
SurvMapper(mymap, fills ="Dummy_status", Legend_title = "Testing this", col_scale = "red")
# Chloropleth map with some additional options
SurvMapper(mymap, fills ="Dummy_status", Legend_title = "Testing this",
fill_levels = c("Dummy4",
"Dummy3",
"Dummy2",
"Dummy1",
"No data"),
col_scale = "red", reverse_colours = TRUE)
# Note that you can map at once several columns, but all options are not yet available for this scenario -
# e.g. level order is good to be predefined if plotting several columns. And depends on graphical device (e.g. recording)
SurvMapper(mymap, fills = c("Dummy_status", "Dummy2"), Legend_title = c("Testing this", "And also this"),
col_scale = c("blue", "qualitative"))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.