Description Usage Arguments Value Author(s) References See Also Examples
Easy boxplot plot with R package ggplot2
1 2 3 4 5 | ggplot2.boxplot(data, xName = NULL, yName = NULL, groupName = NULL,
position = "dodge", addMean = F, meanPointShape = 5,
meanPointSize = 4, meanPointColor = "black", meanPointFill = "blue",
addDot = FALSE, dotSize = 1, dotPosition = c("center", "jitter"),
jitter = 0.2, groupColors = NULL, brewerPalette = NULL, ...)
|
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 |
Position adjustment, either as a string, or the result of a call to a position adjustment function. |
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" |
addDot |
If TRUE, dotplot is added on the boxplot. Default value is FALSE. |
dotSize |
The size of dots. |
dotPosition |
Possible values are "center" and "jitter". Default value is "center". |
jitter |
Degree of jitter in x direction. Default value is 0.2. |
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 and to geom_boxplot functions from ggplot2 package. |
a ggplot
Alboukadel Kassambara <alboukadel.kassambara@gmail.com>
http://www.sthda.com
ggplot2.dotplot, ggplot2.violinplot,
ggplot2.stripchart, ggplot2.density,
ggplot2.histogram
1 2 3 4 5 6 7 8 9 10 | df <- ToothGrowth
ggplot2.boxplot(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.boxplot(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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.