Skip to content

Ribbons in geom_smooth  #190

Closed
Closed
@cpsievert

Description

@cpsievert

A user tried to recreate the following example in plotly.

p <- (qplot(Date, Score, colour=Program, data=x)
      +stat_smooth(method=lm)+facet_wrap(~Name)
      +scale_x_date(labels=date_format("%b/%y"))
      +scale_color_fivethirtyeight()+theme_fivethirtyeight())

asada vs yuna

However, the plotly result is:

This is clearly a bug, but before I fix it, it'd be nice to have a discussion on how best to implement the ribbon in geom_smooth().

Alex mentioned that each ribbon should should be 2 traces, so that upon hover in compare mode, we can compare the top and bottom. I definitely agree that would be useful. My question however is: why isn't geom_ribbon() implemented this way?

The current approach is basically to treat geom_smooth() as geom_line() + geom_ribbon(). So if we re-implement geom_ribbon() as 2 traces, that change should propagate to geom_smooth().

Thoughts @tdhock @chriddyp @mkcor?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions