Description Usage Arguments Value Examples
Draw an electoral map, with insets.
1 2 3 4 5 | draw_electoral_divisions_map(.polygonal.data, year = c("2016", "2013",
"2010", "2007", "2004"), scale_fill_manual_args = NULL,
scale_fill_gradientn_args = NULL, polygon_outline_colour = "black",
city_inset_scale = 13, base_size = 25, base_family = "",
city_inset_text_size = 25, legend.title = NULL)
|
.polygonal.data |
Data including the vertices of all polygons, including a |
year |
What elections' boundaries should be used? |
scale_fill_manual_args |
A list of arguments to pass to |
scale_fill_gradientn_args |
A list of arguments to pass to |
polygon_outline_colour |
The outline of polygons. |
city_inset_scale |
By how much should the cities' insets be scaled by relative to the Australia plot? |
base_size, base_family |
Passed to |
city_inset_text_size |
Title size in points. |
legend.title |
What should the legend title (for |
A printed ggplot object.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | library(grattanCharts)
library(hutils)
library(ggplot2)
library(scales)
library(data.table)
library(magrittr)
system.file(package = "grattanElectionMaps",
"examples/wellbeing.csv") %>%
fread %>%
.[, ELECT_DIV := toupper(gsub("[^A-Za-z]", "", Electorate))] %>%
.[aus_division_elect_map_simple_2016, on = "ELECT_DIV"] %T>%
.[, stopifnot(!anyNA(SE), uniqueN(Rank) == 150L)] %>%
setnames("Personal wellbeing index", "fill") %>%
draw_electoral_divisions_map(
scale_fill_gradientn_args = list(colors = gpal(7)),
legend.title = "Well-being",
city_inset_scale = c("PER" = 26,
"ADL" = 24,
"MEL" = 18,
"SYD" = 14,
"BNE" = 14),
city_inset_text_size = 18,
base_size = 20)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.