prettypie: prettypie

Description Usage Arguments Examples

View source: R/plot_special.R

Description

A pie chart. prettypie is stupid, ignore it; use prettypie2,

Usage

1
2
3
prettypie(dat, main = NULL, sub = NULL, note = NULL)

prettypie2(x, group = 1, labels = NA, col = NULL, radius = c(0.7, 1))

Arguments

dat

data

main, sub, note

overall title, sub-title, and note for plot

x

numeric vector representing the size for each slice

group

vector identifying groups of slices (used by col)

labels

vector of labels for individual slices; if NA, no labels will be drawn; if NULL, slices will be labeled sequentially

col

colors for each group of slices

radius

radius for inner and outer pie (usually in [0,1])

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
browsers <- source(system.file('source','browsers.r', package = 'plotr'))$value
browsers <- within(browsers, total <- ave(share, browser, FUN = sum))
browsers <- browsers[c('browser', 'version', 'share', 'total')]

m1 <- 'Browser market share, April 2011'
s1 <- 'stackoverflow.com:::maryam'
n1 <- '/questions/26748069/ggplot2-pie-and-donut-chart-on-same-plot'
prettypie(browsers, m1, s1, n1)


disease <- source(system.file('source','disease.r', package = 'plotr'))$value
disease <- disease[c('Disease', 'Acosts60', 'Pcosts60', 'Patients60', 'Total60')]

m2 <- 'Cost of getting sick'
s2 <- 'Inside: Personal Costs, outside: Insurer Costs'
n2 <- 'visualization.geblogs.com/visualization/health_costs/'
prettypie(disease, m2, s2, n2)

## Not run: 
pdf('~/desktop/prettypie-browsers.pdf', width = 15, height = 11, bg = 'snow')
prettypie(browsers, m1, s1, n1)
dev.off()

pdf('~/desktop/prettypie-disease.pdf', width = 15, height = 11, bg = 'snow')
prettypie(disease, m2, s2, n2)
dev.off()

## End(Not run)

## basic usage
prettypie2(mtcars$mpg)

with(mtcars, prettypie2(mpg, interaction(gear, cyl), rownames(mtcars)))

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