Draw a PieDonut plot

PieDonut(data, mapping, start = 0, addPieLabel = TRUE,
  addDonutLabel = TRUE, showRatioDonut = TRUE, showRatioPie = TRUE,
  ratioByGroup = TRUE, showRatioThreshold = 0.02, labelposition = 2,
  labelpositionThreshold = 0.1, r0 = 0.3, r1 = 1, r2 = 1.2,
  explode = NULL, selected = NULL, explodePos = 0.1, color = "white",
  pieAlpha = 0.8, donutAlpha = 1, maxx = NULL, showPieName = TRUE,
  showDonutName = FALSE, title = NULL, pieLabelSize = 4,
  donutLabelSize = 3, titlesize = 5, explodePie = TRUE,
  explodeDonut = FALSE, use.label = TRUE, use.labels = TRUE)

Arguments

data

A data.frame

mapping

Set of aesthetic mappings created by aes or aes_.

start

offset of starting point from 12 o'clock in radians

addPieLabel

A logical value. If TRUE, labels are added to the Pies

addDonutLabel

A logical value. If TRUE, labels are added to the Donuts

showRatioDonut

A logical value. If TRUE, ratios are added to the DonutLabels

showRatioPie

A logical value. If TRUE, ratios are added to the PieLabels

ratioByGroup

A logical value. If TRUE, ratios ara calculated per group

showRatioThreshold

An integer. Threshold to show label as a ratio of total. default value is 0.02.

labelposition

A number indicating the label position

labelpositionThreshold

label position threshold. Default value is 0.1.

r0

Integer. start point of pie

r1

Integer. end point of pie

r2

Integer. end point of donut

explode

pies to explode

selected

donuts to explode

explodePos

explode position

color

color

pieAlpha

transparency of pie

donutAlpha

transparency of pie

maxx

maximum position of plot

showPieName

logical. Whether or not show Pie Name

showDonutName

logical. Whether or not show Pie Name

title

title of plot

pieLabelSize

integer. Pie label size

donutLabelSize

integer. Donut label size

titlesize

integer. Title size

explodePie

Logical. Whether or not explode pies

explodeDonut

Logical. Whether or not explode donuts

use.label

Logical. Whether or not use column label in case of labelled data

use.labels

Logical. Whether or not use value labels in case of labelled data

Examples

require(moonBook)
#> Loading required package: moonBook
require(ggplot2) browser=c("MSIE","Firefox","Chrome","Safari","Opera") share=c(50,21.9,10.8,6.5,1.8) df=data.frame(browser,share) PieDonut(df,aes(browser,count=share),r0=0.7,start=3*pi/2,labelpositionThreshold=0.1)
PieDonut(df,aes(browser,count=share),r0=0.7,explode=5,start=3*pi/2)
PieDonut(mtcars,aes(gear,carb),start=3*pi/2,explode=3,explodeDonut=TRUE,maxx=1.7)
#> Warning: Ignoring unknown aesthetics: explode
PieDonut(mtcars,aes(carb,gear),r0=0)
PieDonut(acs,aes(smoking,Dx),title="Distribution of smoking status by diagnosis")
PieDonut(acs,aes(Dx,smoking),ratioByGroup=FALSE,r0=0)
PieDonut(acs,aes(Dx,smoking),selected=c(1,3,5,7),explodeDonut=TRUE)
#> Warning: Ignoring unknown aesthetics: explode
PieDonut(acs,aes(Dx,smoking),explode=1,selected=c(2,4,6,8),labelposition=0,explodeDonut=TRUE)
#> Warning: Ignoring unknown aesthetics: explode
PieDonut(acs,aes(Dx,smoking),explode=1)
PieDonut(acs,aes(Dx,smoking),explode=1,explodeDonut=TRUE,labelposition=0)
#> Warning: Ignoring unknown aesthetics: explode
PieDonut(acs,aes(Dx,smoking),explode=1,explodePie=FALSE,explodeDonut=TRUE,labelposition=0)
#> Warning: Ignoring unknown aesthetics: explode
PieDonut(acs,aes(Dx,smoking),selected=c(2,5,8), explodeDonut=TRUE,start=pi/2,labelposition=0)
#> Warning: Ignoring unknown aesthetics: explode
PieDonut(acs,aes(Dx,smoking),r0=0.2,r1=0.9,r2=1.3,explode=1,start=pi/2,explodeDonut=TRUE)
#> Warning: Ignoring unknown aesthetics: explode
PieDonut(acs,aes(Dx,smoking),r0=0.2,r1=0.9,r2=1.3,explode=1,start=pi/2,labelposition=0)
PieDonut(acs,aes(Dx,smoking),explode=1,start=pi,explodeDonut=TRUE,labelposition=0)
#> Warning: Ignoring unknown aesthetics: explode
require(dplyr)
#> Loading required package: dplyr
#> #> Attaching package: ‘dplyr’
#> The following objects are masked from ‘package:stats’: #> #> filter, lag
#> The following objects are masked from ‘package:base’: #> #> intersect, setdiff, setequal, union
df=mtcars %>% group_by(gear,carb) %>% summarize(n=n()) PieDonut(df,aes(pies=gear,donuts=carb,count=n),ratioByGroup=FALSE)