Chciałbym facet_wrap mapę mapę przez zmienną danych w ggplot2 - np. "zwierzęta" w poniższym przykładzie. Czy wymaga to pełnego powielenia wzmocnionych danych map dla każdej kategorii zmiennych? Byłoby to trochę głupie. Czy istnieje alternatywna metoda?Mapy z facet_wrap w ggplot2
require(ggplot2)
(nz_dat = data.frame(island = rep(c('North.Island ','South.Island '), 3),
pets = c('cats','cats','dogs','dogs','birds','birds'),
n = c(13, 26, 48, 74, 24, 17)))
island pets n
1 North.Island cats 13
2 South.Island cats 26
3 North.Island dogs 48
4 South.Island dogs 74
5 North.Island birds 24
6 South.Island birds 17
nz = map_data("nz")
nz = subset(nz, nz$region %in% c('North.Island ','South.Island ')) # 2 main islands
# simple plot
ggplot(nz, aes(long, lat, group=group, fill=factor(region))) +
geom_polygon() + coord_quickmap()
'coord_quickmap' był dobry wybór dla zbliżenia NZMG w ggplot w/o uciekania się do pre- projektowanie najpierw! – hrbrmstr