On 1/24/2008 9:43 AM, Juan Pablo Fededa wrote:
> Dear Contributors:
> 
> I have two vectors x and z, and I want to display the histograms of both
> vectors in the same graph, x in red bars, z in blue bars.
> If you have any clue on how to do that, I will be very glad to hear it!!!!!!

It's hard to design a graph like this that looks good, but it's easy to 
draw using add=TRUE:

x <- rnorm(1000)
y <- rnorm(1000, mean=1)
breaks <- pretty(range(c(x,y)), 20)
hist(x, breaks=breaks, col='red', main="Hist of x and y")
hist(y, breaks=breaks, add=TRUE, border='blue')

Duncan Murdoch

______________________________________________
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