[R] The simplest bar graph with ggplot is difficult to realize
Ista Zahn
izahn at psych.rochester.edu
Wed Jun 8 17:40:00 CEST 2011
Hi Juan,
Each geom can have it's own stat, so stat_identity() doesn't change
the stat used by geom_bar(). You need
ggplot(d, aes(x=x, y=y)) + geom_bar(stat="identity")
Best,
Ista
2011/6/8 Juan Carlos Borrás <jcborras at gmail.com>:
> Dear all,
> What is the simplest way of producing a bar graph using ggplot but
> avoiding calling qplot?
>
> That is, given:
> d <- data.frame(x=seq(1,5), y=seq(1,5))
>
> Why does the following line return an error?
> ggplot(d, aes(x=x, y=y)) + stat_identity() + geom_bar(bindwidth=1)
>
> Thanks in advance,
> jcb!
>
> ______________________________________________
> 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.
>
--
Ista Zahn
Graduate student
University of Rochester
Department of Clinical and Social Psychology
http://yourpsyche.org
More information about the R-help
mailing list