[R] Histogram with two colors depending on condition

hadley wickham h.wickham at gmail.com
Thu Jul 17 11:42:21 CEST 2008


On Thu, Jul 17, 2008 at 5:13 PM, Mohammad Ehsanul Karim
<wildscop at yahoo.com> wrote:
> Dear List,
>
> Say, we generate data like this-
>
> dat<-rnorm(1000,1,2)
> hist(dat)

library(ggplot)
qplot(dat, geom="histogram", colour = factor(dat < 0))

Hadley


-- 
http://had.co.nz/



More information about the R-help mailing list