PieDonut: Draw a PieDonut plot

Description Usage Arguments Examples

View source: R/PieDonut.R

Description

Draw a PieDonut plot

Usage

 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
34
PieDonut(
  data,
  mapping,
  start = getOption("PieDonut.start", 0),
  addPieLabel = TRUE,
  addDonutLabel = TRUE,
  showRatioDonut = TRUE,
  showRatioPie = TRUE,
  ratioByGroup = TRUE,
  showRatioThreshold = getOption("PieDonut.showRatioThreshold", 0.02),
  labelposition = getOption("PieDonut.labelposition", 2),
  labelpositionThreshold = 0.1,
  r0 = getOption("PieDonut.r0", 0.3),
  r1 = getOption("PieDonut.r1", 1),
  r2 = getOption("PieDonut.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,
  family = getOption("PieDonut.family", "")
)

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

family

font family

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
require(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)
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)
PieDonut(acs,aes(Dx,smoking),explode=1,selected=c(2,4,6,8),labelposition=0,explodeDonut=TRUE)
PieDonut(acs,aes(Dx,smoking),explode=1)
PieDonut(acs,aes(Dx,smoking),explode=1,explodeDonut=TRUE,labelposition=0)
PieDonut(acs,aes(Dx,smoking),explode=1,explodePie=FALSE,explodeDonut=TRUE,labelposition=0)
PieDonut(acs,aes(Dx,smoking),selected=c(2,5,8), explodeDonut=TRUE,start=pi/2,labelposition=0)
PieDonut(acs,aes(Dx,smoking),r0=0.2,r1=0.9,r2=1.3,explode=1,start=pi/2,explodeDonut=TRUE)
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)
require(dplyr)
df=mtcars %>% group_by(gear,carb) %>% summarize(n=n())
PieDonut(df,aes(pies=gear,donuts=carb,count=n),ratioByGroup=FALSE)

cardiomoon/webr documentation built on May 12, 2020, 4:12 a.m.