Skip to content

geom_ribbon() doesn't handle fill/colour/group properly #192

@cpsievert

Description

@cpsievert

Consider the following:

huron <- data.frame(year = 1875:1972, level = as.vector(LakeHuron))
library(plyr) # to access round_any
huron$decade <- round_any(huron$year, 10, floor)
huron$diff <- huron$year - huron$decade
p1 <- ggplot(data = huron, aes(fill = factor(decade))) + 
  geom_ribbon(aes(x = diff, ymin = level-0.1, ymax = level+0.1))
p1

rplot01

However the plotly result is:

Also,

p2 <- ggplot(data = huron, aes(colour = factor(decade))) + 
  geom_ribbon(aes(x = diff, ymin = level-0.1, ymax = level+0.1))
p2

rplot02

And the plotly result is the same as before...

@tdhock suggested here that we treat ribbons as a special case of polygons (as he has done with geom_rect)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions