Learn R Programming

tmod (version 0.19)

simplePie: Simple Pie Chart

Description

The simplePie function draws a simple pie chart at specified coordinates with specified width, height and color. The simpleRug function draws a corresponding rug plot.

Usage

simplePie(x, y, w, h, v, col, res = 100)

simpleRug(x, y, w, h, v, col)

Arguments

x,y
coordinates at which to draw the plot
w,h
width and height of the plot
v
sizes of the slices
col
colors of the slices
res
resolution (number of polygon edges in a full circle)

Details

simplePie() draws a pie chart with width w and height h at coordinates (x,y). The size of the slices is taken from the numeric vector v, and their color from the character vector col.

Examples

Run this code
plot(NULL, xlim=1:2, ylim=1:2)
col <- c("#cc000099", "#0000cc99")
for(i in 1:25) {
  x <- runif(1) + 1
  y <- runif(1) + 1
  simplePie( x, y, 0.05, 0.05, c(x,y), col)
}

Run the code above in your browser using DataLab