If I have a histogram:
> hist(faithful$waiting,seq(min(faithful$waiting),max(faithful$waiting)))
and a list of "special" frequencies:
> c(51, 52, 57, 59, 64)
is it possible to colour the bars corresponding to these special frequencies a different colour from the rest of the histobram?
You could simply create a vector of the colors and use the col
option.
data(faithful)
# make sure frequencies in order and unique for the histogram call
special <- ifelse(sort(unique(faithful$waiting)) %in% c(51, 52, 57, 59, 64), "red", "white")
# same call with the 'col' option
hist(faithful$waiting,seq(min(faithful$waiting),max(faithful$waiting)), col=special)
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments