ggplot2.dotplot: Easy dotplot plot with R package ggplot2

Description Usage Arguments Value Author(s) References See Also Examples

Description

Easy dotplot plot with R package ggplot2

Usage

1
2
3
4
5
ggplot2.dotplot(data, xName = NULL, yName = NULL, groupName = NULL,
  position = position_dodge(0.8), addMean = FALSE, meanPointShape = 5,
  meanPointSize = 4, meanPointColor = "black", meanPointFill = "blue",
  addBoxplot = FALSE, boxplotFill = "white", boxplotColor = "black",
  boxplotLineWeight = 0.5, groupColors = NULL, brewerPalette = NULL, ...)

Arguments

data

data.frame or a numeric vector. Columns are variables and rows are observations.

xName

The name of column containing x variable (i.e groups). Default value is NULL.

yName

The name of column containing y variable. If yName=NULL, data should be a numeric vector.

groupName

The name of column containing group variable. This variable is used to color plot according to the group.

position

The position adjustment to use for overlappling points. Default value is position_dodge(0.8).

addMean

if TRUE, the mean point is added on the plot for each group. Default value is FALSE.

meanPointShape

The shape of mean point.

meanPointSize

The size of mean point

meanPointColor

Border color of the mean point. Default value is "black".

meanPointFill

Fill color of mean point. This parameter is used only when meanPointShape=21 to 25. Default value is "blue"

addBoxplot

If TRUE, boxplot is added on the dotplot. Default value is FALSE.

boxplotFill

Fill color of the boxplot. Default value is white.

boxplotColor

Boxplot line color. Default value is black.

boxplotLineWeight

Boxplot line weight. Default value is 0.5.

groupColors

Color of groups. groupColors should have the same length as groups.

brewerPalette

This can be also used to indicate group colors. In this case the parameter groupColors should be NULL. e.g: brewerPalette="Paired".

...

Other arguments passed on to ggplot2.customize custom function or to geom_dotplot functions from ggplot2 package.

Value

a ggplot

Author(s)

Alboukadel Kassambara <alboukadel.kassambara@gmail.com>

References

http://www.sthda.com

See Also

ggplot2.boxplot, ggplot2.violinplot, ggplot2.stripchart, ggplot2.density, ggplot2.histogram, ggplot2.customize

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
df <- ToothGrowth
ggplot2.dotplot(data=df, xName='dose',yName='len',
                mainTitle="Plot of length according\n to the dose",
                xtitle="Dose (mg)", ytitle="Length")

#Or use this
plot<-ggplot2.dotplot(data=df, xName='dose',yName='len')
plot<-ggplot2.customize(plot, mainTitle="Plot of length according\n to the dose",
                        xtitle="Dose (mg)", ytitle="Length")
print(plot)

YTLogos/easyGgplot2 documentation built on May 3, 2019, 9:03 p.m.