Juan Carlos BorrĂ¡s
2011-Jun-08 15:30 UTC
[R] The simplest bar graph with ggplot is difficult to realize
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!
Ista Zahn
2011-Jun-08 15:40 UTC
[R] The simplest bar graph with ggplot is difficult to realize
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