0

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.

Mikkel Rev
  • 863
  • 3
  • 12
  • 31

1 Answers1

1

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)

enter image description here

Marc in the box
  • 11,769
  • 4
  • 47
  • 97