barmap: Map barplot

Description Usage Arguments Examples

View source: R/plot_special.R

Description

Creates a barplot in the shape of a map region.

Usage

1
barmap(x, db = "worldHires", region, labels = NULL, cols = NULL)

Arguments

x

a vector of proportions summing to 1 (approximately)

db

data base; see map

region

the region; see map

labels

optional vector of labels for each section

cols

a vector of colors for each section

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
op <- par(mar = c(0,0,0,0))
barmap(1, region = 'Germany')

barmap(c(1,1,1) / 3, region = 'Germany', cols = c('red', 'black', 'gold'))
 
voteGermany2013 <- read.table(header = TRUE, text = "Party Result
                              1 CDU/CSU   49.4
                              2     SPD   30.5
                              3   LINKE   10.2
                              4  GRUENE   10.0")
 
with(voteGermany2013,
     barmap(Result / 100, region = 'Germany',
            labels = sprintf('%s (%s%%)', Party, Result)))
par(op)

raredd/plotr documentation built on Nov. 13, 2018, 7:05 a.m.