PositionStack and similar classes that use collide() and collide2 to sort the data expects "group" to be numeric, not factor.
Some Stats may create a "factor" group column, though not those which might be stacked (i.e. StatContour), the problem is relevant for custom Stat extensions that might update group.
The problem arises because for reverse = TRUE, the "collide" functions use order(..., -data$group) instead of order(..., data$group, decreasing = TRUE), as "-" is not meaningful for factors.
|
ord <- order(data$xmin, -data$group) |
ggplot(faithfuld, aes(waiting, eruptions, z = density)) +
geom_contour(position = "stack")
# warning "-" no meaningful for factors
```
PositionStack and similar classes that use
collide()andcollide2to sort the data expects "group" to be numeric, not factor.Some Stats may create a "factor" group column, though not those which might be stacked (i.e. StatContour), the problem is relevant for custom Stat extensions that might update group.
The problem arises because for reverse = TRUE, the "collide" functions use
order(..., -data$group)instead oforder(..., data$group, decreasing = TRUE), as "-" is not meaningful for factors.ggplot2/R/position-collide.R
Line 43 in c02c05a