Dear all,

Let's say I have the following data.frame:

dat<-data.frame(x=rnorm(100), y=rnorm(100,2))

and I plot a histogram of variable x, somethink like:
hist(dat$x, breaks=-5:5)

Now, I'd like to color each bar according to the mean of the cases
according to y. For instance, the color of the bar between -2 and -1 should
reflect the mean of variable y for the corresponding cases. Any suggestions?

John

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to