Bug in stat_density2d after ggplot2 0.8.5

80 views
Skip to first unread message

takahashi kohske

unread,
Feb 24, 2010, 3:35:49 AM2/24/10
to ggplot2
example in ?stat_density2d

d <- ggplot(diamonds, aes(carat, price)) + xlim(1,3)
d + stat_density2d(geom="tile", aes(fill = ..density..), contour = FALSE)

makes a error.

I found that the older bug has been fixed by adding

df$group <- data$group[1]

then subsequent code:

if (contour) {
StatContour$calculate(df, scales, ...)
}
else {
names(df) <- c("x", "y", "density")
df$level <- 1
df$piece <- 1
df
}

in the case contour==FALSE, the code
> names(df) <- c("x", "y", "density")
generates incorrect name of data frame, i.e., NA for column "group".

so I think it should be

names(df) <- c("x", "y", "density", "group")

Thank you in advance.

-KO

hadley wickham

unread,
Feb 24, 2010, 9:53:37 AM2/24/10
to takahashi kohske, ggplot2
Thanks for the bug report. Will be fixed in 0.8.7.
Hadley

> --
> You received this message because you are subscribed to the ggplot2 mailing list.
> To post to this group, send email to ggp...@googlegroups.com
> To unsubscribe from this group, send email to
> ggplot2+u...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/ggplot2

--
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/

Reply all
Reply to author
Forward
0 new messages