Re: [R] help needed with histogram plotting

From: Scott Chamberlain <scttchamberlain4_at_gmail.com>
Date: Sun, 06 Mar 2011 23:19:29 -0600

Does this seems like a good stand in for now:

require(ggplot2)

x <- runif(100,1,2)
y <- runif(100,50,60)
z <- runif(100,99,100)

xyz <- melt(data.frame(x,y,z))

ggplot(xyz, aes(value)) +
geom_histogram() +
facet_grid(~ variable, scale="free")

On Sunday, March 6, 2011 at 9:25 PM, cassie jones wrote:
> Dear all,
>
> I am trying to plot 3 histograms on the same graph using the following
> command.
>
> hist(x,xlim=c(0,100))
> hist(y,add=TRUE)
> hist(z,add=TRUE)
>
> The xlim of y is c(20,21) and that of z is c(99,99.5) , whereas the variable
> x has xlim at c(0.5,2). Apparently, the graph end of displaying a line only,
> corresponding to each histogram due to the wide range of the xlim and
> tightness of the histograms. I need to plot them on the same graph for
> comparison purpose. Can anyone suggest me a better way to do it? I am
> wondering if there is any command in R, where we can break the x-axis into
> several parts putting a 'break' at the discontinuity..what I mean is if the
> x-axis start from 0 and break at say 3, then start at 19 and break at 21 and
> the last part starts at say 98. In this way, the histograms would be
> prominent.
>
> Thanks in advance.
>
>
> Cassie
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help_at_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.
>

        [[alternative HTML version deleted]]



R-help_at_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. Received on Mon 07 Mar 2011 - 05:28:01 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 07 Mar 2011 - 07:50:19 GMT.

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

list of date sections of archive