I want to change the bin labels when using the multhist
-function from the plotrix package. By bin labels, I mean the labels
under each set of columns in the histograms.
Thanks.
I want to change the bin labels when using the multhist
-function from the plotrix package. By bin labels, I mean the labels
under each set of columns in the histograms.
Thanks.
The trick is to provide names to your breaks intervals, just as you would with the names.arg
argument in barplot
:
# install.packages("plotrix")
library(plotrix)
set.seed(1)
l <- list(rnorm(50),rnorm(50,sd=2),rnorm(50,mean=3))
breaks <- pretty(unlist(l))
levs <- levels(cut(unlist(l), breaks=breaks))
multhist(l, breaks=breaks, names.arg = levs)