violinPlot: Violin plot

Description Usage Arguments Value Author(s) See Also Examples

View source: R/violinPlot.R

Description

Produce a quick violin plot with a boxplot inside from a data frame or matrix and if wanted a vector with group membership

Usage

1
2
violinPlot(df, group=NULL, same=TRUE, missing=TRUE, color="#F4A460", group1="Group1",
group2="Group2", legendLab="Group", title1="Title", numBreaks=10)

Arguments

df

vector, data frame or matrix

group

variable group (df$variable)

same

If you want one plot with all groups set to TRUE, otherwise FALSE

color

color when group is NULL (default "#F4A460")

colorBox

boxplot color for group (default = "Spectral" from RColorBrewer)

labList

default NULL uses factor levels as group membership label.Else list (p.eg c("group1", "group2"))

legendLab

Legend title label (default="Group")

title1

Plot title (default=NULL)

numBreaks

when there are more than 15 response values breaks are modified for better visualization (default=10)

Value

plot

Author(s)

Ariadna Angulo-Brunet (ariadna.angulo@uab.cat), Carme Viladrich

See Also

boxPlot, ggplot2

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
#generate some random data
x<-1:5
y<-c("Female", "Male")
v1<-sample(x,80,replace=TRUE)
v2<-sample(x,80,replace=TRUE)
v3<-sample(x,80,replace=TRUE)
v4<-sample(x,80,replace=TRUE)
gender<- sample(y, 80, replace=TRUE)
df <- data.frame(v1, v2,v3,v4)

#default plot
violinPlot(df)

#change color 
violinPlot(df, color="green")

#by group 
violinPlot(df, gender)

#a plot for each group 
violinPlot(df, gender, out="rearrange")

AnguloB/SubscaleExplorer documentation built on Jan. 3, 2021, 2:57 p.m.