user3036843
user3036843

Reputation: 77

Axis titles on vioplot

I want to make a violin plot which is working fine. I have created the plot and added a title using the functions:

library(vioplot)
vioplot(x1, x2, x3, names=c("red", "green", "blue"), col="aliceblue") col="aliceblue")
title("Violin Plot")

But can't get the y or x axis titles which are the last things I need. I have tried.

ylab=("response")

ylab("response")

ylabel=("response")

ylabel("response")

All separately but it is not working. Do I have to include the y axis title in the main code for the plot?

Likewise I cannot label the X-axis ("colours").

Is this something which is beyond vioplot? and is there a way round it that is relatively basic?

Thanks

Upvotes: 3

Views: 6072

Answers (1)

IRTFM
IRTFM

Reputation: 263451

Ifvioplot (from an unnamed package) is a base or lattice graphics function, then you should set ylab="" in the call, and you can then use title(ylab="response", xlab="colours") to fill in with "response"/"colours" or whatever character values you desire. The title function is used (after a plot-like call) for several named locations on the abstract base plot layout: "main" for what most people would call "title", and/or "xlab" and "ylab" for the centered axis-descriptions (but not the tick labels) .

?title

Upvotes: 5

Related Questions