I have a data.frame
, for example:
df = data.frame(AAA=rnorm(100,1,1),BBB=rnorm(100,2,1.5),CCC=rnorm(100,1.5,1.2))
And I'd like to plot each of its columns in a joint violin plot.
Here's where I'm at so far:
names(df)[1] = 'x'
do.call('vioplot', c(df,col="red",drawRect=FALSE))
What I want to do next is to plot the colnames of df
as x-axis labels rather than the default x-axis labels of vioplot
and in addition in a way that they don't run over each other. I imagine this can be achieved either by spreading the columns of df
in the plot or by slanting the x-axis labels. But I can't figure that out.