ggDot: Draw a Wilkinson dot plot

Description Usage Arguments Examples

View source: R/ggDot.R

Description

Draw a Wilkinson dot plot

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
ggDot(
  data,
  mapping,
  stackdir = "center",
  binaxis = "y",
  binwidth = 0.5,
  method = "dotdensity",
  position = 0.2,
  boxwidth = 0.25,
  boxfill = NULL,
  use.label = TRUE,
  use.labels = TRUE,
  ...
)

Arguments

data

a data.frame

mapping

Set of aesthetic mappings created by aes or aes_.

stackdir

which direction to stack the dots. "up" (default), "down", "center", "centerwhole" (centered, but with dots aligned)

binaxis

The axis to bin along, "x" (default) or "y"

binwidth

When method is "dotdensity", this specifies maximum bin width. When method is "histodot", this specifies bin width. Defaults to 1/30 of the range of the data

method

"dotdensity" (default) for dot-density binning, or "histodot" for fixed bin widths (like stat_bin)

position

Position adjustment. If 0, no adjustment.

boxwidth

The width of boxplot

boxfill

Fill color of boxplot

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

...

other arguments passed on to geom_dotplot

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
require(ggplot2)
if(requireNamespace("gcookbook",quietly=TRUE)){ # for data heightweight
 require(gcookbook)
 ggDot(heightweight,aes(sex,heightIn,fill=sex),boxfill="white",binwidth=0.4)
 ggDot(heightweight,aes(heightIn))
 ggDot(heightweight,aes(x=heightIn,fill=sex))
}
require(moonBook) #for use data radial
ggDot(radial,aes(x=sex,y=height,fill=sex),boxfill="white",position=0,binwidth=1,boxwidth=1)
ggDot(radial,aes(x=height,fill=sex),binwidth=1)
ggDot(acs,aes(x=sex,y=age,color=sex))
ggDot(acs,aes(x=Dx,y=age,color=Dx))

Example output

Loading required package: ggplot2
Loading required package: gcookbook
Loading required package: moonBook
Warning messages:
1: Removed 1 rows containing non-finite values (stat_boxplot). 
2: Removed 1 rows containing non-finite values (stat_bindot). 
Warning message:
Removed 1 rows containing non-finite values (stat_bindot). 
Warning messages:
1: In FUN(X[[i]], ...) : NAs introduced by coercion
2: In FUN(X[[i]], ...) : NAs introduced by coercion
3: Removed 857 rows containing non-finite values (stat_boxplot). 
4: Removed 857 rows containing non-finite values (stat_bindot). 
Warning messages:
1: In FUN(X[[i]], ...) : NAs introduced by coercion
2: In FUN(X[[i]], ...) : NAs introduced by coercion
3: Removed 857 rows containing non-finite values (stat_boxplot). 
4: Removed 857 rows containing non-finite values (stat_bindot). 

ggiraphExtra documentation built on Oct. 23, 2020, 7:39 p.m.