barmap | R Documentation |
Creates a barplot in the shape of a map region.
barmap(x, db = "worldHires", region, labels = NULL, cols = NULL)
x |
a vector of proportions summing to 1 (approximately) |
db |
data base; see |
region |
the region; see |
labels |
optional vector of labels for each section |
cols |
a vector of colors for each section |
op <- par(mar = c(0, 0, 0, 0))
barmap(1, region = 'Germany')
barmap(c(1, 1, 1) / 3, region = 'Germany', cols = c('gold', 'red', 'black'))
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.