No path with stat="summary" #732

low-decarie opened this Issue Dec 5, 2012 · 11 comments

7 participants


Thank you for all the good work.

This comes from a discussion on google group:!search/With$20stat=%22summary%22,$20fun.y=%22mean%22$20get$20%22Each$20group$20consist$20of$20only$20one$20observation%22/ggplot2/ECI59jsdOYc/CCm1MOxXnhEJ


d <- qplot(cyl, mpg, data=mtcars)
d + geom_line(stat="summary", fun.y="mean")


stat_sum_single <- function(fun, geom="point", ...) {
  stat_summary(fun.y=fun, colour="red", geom=geom, size = 3, ...)

d + stat_sum_single(mean, geom="line", aes(group=as.character(cyl)))


ggplot(mtcars, aes(x=cyl, y=mpg)) +
  geom_point() +
  stat_summary(fun.y=mean, geom="line", aes(group=factor(cyl)))


all give
"geom_path: Each group consist of only one observation. Do you need to adjust the group aesthetic?"

with no path traced on plot


same as #739 ?


Also, this error seems to have propagated to the documentation (for example, plot nbr 6):


bump ... ? any thoughts from developers about whether this is easy or hard to fix, or work around?



breaks lots of plots. Does anyone know which version to one should revert to in order to get the desired behaviour?


This is a pretty frustrating regression. Would love to see a fix, or at least a comment on it, soon...


Sorry, we've been occupied with other things recently. We'll probably have a release with a fix for this.


I write an temporary patch that can draw the line with stat_summary.
I write it for my own use, but as this change may introduce huge problem (even for me...), I put it on gist.

Here is a simple usage:



d <- qplot(cyl, mpg, data=mtcars)
d <- d + aes(colour = factor(vs)) + stat_summary(fun.y = mean, geom="line")

Note that you need to install devtools.

@hadley and @wch Please let me know if I should not share this on gist.


@kohske, so this basically changes StatSummary back to the previous version? I think that should be OK as a temporary fix.


@wch yes. It is same as


@kohske, thanks a lot. This really saved my plots!

@wch wch added a commit to wch/ggplot2 that referenced this issue Feb 27, 2013
@wch wch Revert stat_summary grouping. Fixes #739 and #732 525bcca
@wch wch added a commit to wch/ggplot2 that referenced this issue Mar 1, 2013
@wch wch Revert stat_summary grouping. Fixes #739 and #732 deb4c50
wch commented Mar 1, 2013

Fixed by #770.

@wch wch closed this Mar 1, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment