pieSymbols: Produce pie charts at specified locations on a map

Description Usage Arguments Examples

Description

This function draw a pie chart at specified locations on a map.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
pieSymbols(
  x,
  y,
  values,
  sizes = NULL,
  edges = 360,
  clockwise = FALSE,
  init.angle = if (clockwise) 90 else 0,
  density = NULL,
  angle = 45,
  col = NULL,
  border = NULL,
  lty = NULL,
  main = NULL,
  ...
)

Arguments

x

x coordinate of where the pie will be plotted

y

y coordinate of where the pie will be plotted

values

the values that will become the percentages of the pie.

sizes

the size of each pie.

edges

the number of increments used to describe the circle of the pie.

clockwise

whether the divisions are in clockwise order.

init.angle

where the pie starts te divisions

col

pie colors (length must be the same as ncol values)

border

border color(s) of the pies

...

passed to default plot function

Examples

1
2
3
4
5
6
7
8
data(SainteMarie85)
grains$SymSizes <- grains$SiloCount*8 #specify symbol sizes in map units
plotmat <- arrangeSymbols(grains, grains$SymSizes) #alternative pie locations
flines <- flylines(coordinates(grains)[,1],coordinates(grains)[,2],plotmat[,1],plotmat[,2]) #fly-lines from real locations to pie locations.
plot(boghar, col="grey75", border=NA, axes=TRUE, main="Barley (brown) and wheat (yellow)\nin 19th grain silos (Boghar, Algeria)") #background map
lines(flines, lwd=0.5) #fly-lines
pieSymbols(x=plotmat[,1], y=plotmat[,2], values=grains@data[,c("BarleyHL","WheatHL")], sizes=grains$SymSizes, col=c("saddlebrown","yellow")) #pies
points(grains, pch=19, cex=0.3, col="black") #real locations

ahb108/sparch documentation built on Feb. 3, 2021, 1:21 a.m.