[R] geom_histogram help

John Kane jrkrideau at yahoo.ca
Tue Jul 21 15:31:10 CEST 2009


Without your code it is impossible to say why you are getting the error message.  

However, are you aware that you need to have a classifying variable to set the colours?  

Try this to see if it is something like what you want.
======================================================================
library(ggplot2)
dd  <- rnorm(100, 5, 2)
cuts <- cut(dd, breaks =c(3,5,7))
mydata=data.frame(dd,cuts)
p=qplot(dd, data=mydata, geom_histogram="histogram", fill = cuts)
p

======================================================================




--- On Tue, 7/21/09, rajesh j <akshay.rajesh at gmail.com> wrote:

> From: rajesh j <akshay.rajesh at gmail.com>
> Subject: Re: [R] geom_histogram help
> To: "Uwe Ligges" <ligges at statistik.tu-dortmund.de>
> Cc: r-help at r-project.org
> Received: Tuesday, July 21, 2009, 9:00 AM
> its a function in ggplot2 for
> plotting complicated histograms.
> 
> 2009/7/21 Uwe Ligges <ligges at statistik.tu-dortmund.de>
> 
> >
> >
> > rajesh j wrote:
> >
> >> Hi,
> >> I have a histogram.But I need seperate colours for
> fixed range of
> >> values.for
> >> eg. between 2-3 on the x axis a colour.3-4 another
> colour etc. and the
> >> legend has to say what each colour is.How can this
> be done in
> >> geom_histogram?
> >>
> >
> >
> > > geom_histogram
> > Error: object 'geom_histogram' not found
> >
> >
> > Hmnmm, looks liek we are not talking about base R?
> > Hard to help without knowing which function from which
> package we are
> > talking about....
> >
> > Uwe Ligges
> >
> 
> 
> 
> -- 
> Rajesh.J
> 
>     [[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.
> 


      __________________________________________________________________
Looking for the perfect gift? Give the gift of Flickr! 

http://www.flickr.com/gift/




More information about the R-help mailing list