Photos
Blog
Projects
vanrenterghem.biz
projects
/
R
/
project-au-taxstats.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
6c51de5
)
Share scale across plots. Remove unused code.
author
Frederik Vanrenterghem
<frederik@vanrenterghem.biz>
Thu, 9 Nov 2017 11:20:12 +0000
(19:20 +0800)
committer
Frederik Vanrenterghem
<frederik@vanrenterghem.biz>
Thu, 9 Nov 2017 11:20:12 +0000
(19:20 +0800)
AU-taxstats.R
patch
|
blob
|
history
diff --git
a/AU-taxstats.R
b/AU-taxstats.R
index ed909fcf50edba0fd0659d0909b255e236bbc7b0..75154d4599752dd4507388efca6ad5423a73bc33 100644
(file)
--- a/
AU-taxstats.R
+++ b/
AU-taxstats.R
@@
-41,8
+41,6
@@
if(!file.exists("data/SA3_2016_AUST.shp"))
unzip(zipfile = "data/1270055001_sa3_2016_aust_shape.zip", exdir = "data/")
sa3 <- st_read(dsn = "data/", layer = "SA3_2016_AUST", stringsAsFactors = FALSE)
unzip(zipfile = "data/1270055001_sa3_2016_aust_shape.zip", exdir = "data/")
sa3 <- st_read(dsn = "data/", layer = "SA3_2016_AUST", stringsAsFactors = FALSE)
-# This doesn't work
-#taxstats.sa3 <- merge(x = taxstats, y = sa3, by.x = "Postcode", by.y = "POA_CODE16", all.y = TRUE)
# Create a matrix of intersecting postal codes and SA3's
# Create a matrix of intersecting postal codes and SA3's
@@
-66,8
+64,10
@@
cities = c("Perth","Melbourne","Sydney","Adelaide","Brisbane")
plots <- function() {lapply(cities, function(x){
plot <- ggplot(dplyr::filter(sa3, data.table::`%like%`(GCC_NAME16, x) )) +
geom_sf(aes(fill = incomeperearningcapita, color = incomeperearningcapita)) +
plots <- function() {lapply(cities, function(x){
plot <- ggplot(dplyr::filter(sa3, data.table::`%like%`(GCC_NAME16, x) )) +
geom_sf(aes(fill = incomeperearningcapita, color = incomeperearningcapita)) +
- scale_fill_viridis(name = "") +
- scale_color_viridis(name = "") +
+ scale_fill_viridis(name = "",
+ limits = c(min(sa3$incomeperearningcapita, na.rm = TRUE),max(sa3$incomeperearningcapita, na.rm = TRUE))) +
+ scale_color_viridis(name = "",
+ limits = c(min(sa3$incomeperearningcapita, na.rm = TRUE),max(sa3$incomeperearningcapita, na.rm = TRUE))) +
coord_sf(datum = NA) + # Work around https://github.com/tidyverse/ggplot2/issues/2071 to remove gridlines
labs(title = paste0(x," \nincome distribution"),
subtitle = "2014/15, in 1000s AUD",
coord_sf(datum = NA) + # Work around https://github.com/tidyverse/ggplot2/issues/2071 to remove gridlines
labs(title = paste0(x," \nincome distribution"),
subtitle = "2014/15, in 1000s AUD",