Description Usage Arguments Value Author(s) References See Also Examples
Easy violinplot plot with R package ggplot2
1 2 3 4 5 |
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. |
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_violin functions from ggplot2 package. |
a ggplot
Alboukadel Kassambara <alboukadel.kassambara@gmail.com>
http://www.sthda.com
ggplot2.dotplot, ggplot2.boxplot,
ggplot2.stripchart, ggplot2.density, ggplot2.histogram
1 2 3 4 5 6 7 8 9 10 | df <- ToothGrowth
ggplot2.violinplot(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.violinplot(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.