Learn R Programming

SciencesPo (version 1.3.9)

pie.plot: Creates a pie chart using ggplot2.

Description

Use pie charts with care. See http://www.edwardtufte.com/bboard/q-and-a-fetch-msg?msg_id=00018S on Edward Tufte's website for good arguments against the use of pie charts. For a contrary point-of-view, see Spence's article, No Humble Pie: The Origins and Usage of a Statistical Chart (http://www.psych.utoronto.ca/users/spence/Spence

Usage

pie.plot(.data, var, label = var)

Arguments

.data
the data frame.
var
the name of the column to generate the pie chart for.
label
The label for the legend.

encoding

UTF-8

Examples

Run this code
if (interactive()) {
x = sample(10, 100, rep = TRUE)
z = sample(letters[1:3],100, rep=TRUE)
dat = data.frame(x,z)
pie.plot(dat, 'x', 'z')
}

Run the code above in your browser using DataLab