On 08-Jun-09 13:11:03, sedm1000 wrote: > I've looked long and hard for this, but maybe I am missing something... > > There is a nice module that displays histograms reflected in the > y axis, i.e. > http://addictedtor.free.fr/graphiques/RGraphGallery.php?graph=136 > > but is it possible to reflect in the x-axis, so to have two datasets, > one pointing up and one down rather than left and right? I haven't > been able to find a way to plot this way using the guide, or elsewhere. > > Thanks... > --
Try along the lines of: set.seed(54321) X1 <- rnorm(500) X2 <- rnorm(500) H1 <- hist(X1,breaks=0.5*((-8):8),ylim=c(-100,100)) H1 <- hist(X1,breaks=0.5*((-8):8),ylim=c(-100,100),col="red") H2 <- hist(X2,breaks=0.5*((-8):8),plot=FALSE) H3<-H2 ; H3$counts <- -H3$counts plot(H3,add=TRUE,col="blue") NB: The choice of breaks and ylim was made after a preliminary inspection of hist(X1) and hist(X2). Ted. -------------------------------------------------------------------- E-Mail: (Ted Harding) <ted.hard...@manchester.ac.uk> Fax-to-email: +44 (0)870 094 0861 Date: 08-Jun-09 Time: 15:50:48 ------------------------------ XFMail ------------------------------ ______________________________________________ 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.