[R] Histbackback and adding color

From: Harshal D Dedhia <harshal_at_yahoo-inc.com>
Date: Fri 16 Jun 2006 - 05:35:30 EST


I am trying to plot two histograms using histbackback and then adding color to each of the samples. The code I have seen on the R graph gallery suggests the following method of using histbackback  

require(Hmisc)

age <- rnorm(1000,50,10)
sex <- sample(c('female','male'),1000,TRUE)
out <- histbackback(split(age, sex), probability=TRUE, xlim=c(-.06,.06),
                    main = 'Back to Back Histogram')


#! just adding color
barplot(-out$left, col="red" , horiz=TRUE, space=0, add=TRUE, axes=FALSE)
barplot(out$right, col="blue", horiz=TRUE, space=0, add=TRUE, axes=FALSE)
I get the following message when I execute the snippet to add color Warning messages:
1: parameter "add" could not be set in high-level plot() function 2: parameter "add" could not be set in high-level plot() function  

Any help would be appreciated.  

        [[alternative HTML version deleted]]



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Fri Jun 16 06:51:42 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Fri 16 Jun 2006 - 08:12:33 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.