[R] About colours in violin and simple violin plots

Fernando Marmolejo Ramos fernando.marmolejoramos at adelaide.edu.au
Wed Aug 6 05:46:59 CEST 2008


Dear R users

Let’s assume I have the following batches of data

a <- rnorm(20,200,100)
b <- rnorm(20,250,100)
c <- rnorm(20,300,100)

# I plot them as violin plots
require(vioplot)
vioplot(a, b, c)

# I plot them as simple violin plots
require(UsingR)
simple.violinplot(a, b, c)

# I plot them as boxplots
boxplot(a, b, c)
# I know that for boxplots I can colour them by col=c("white", "blue", "red")
# but this does not work for the other plots :-(

The question is:
How can I give different colours to each violin plot?
How can I put labels to each violin/boxplot plot instead of the numbers that
appear underneath them?

Cheers,

Fer



More information about the R-help mailing list