Skip to content

Ribbons in geom_smooth #190

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
cpsievert opened this issue Mar 18, 2015 · 1 comment
Closed

Ribbons in geom_smooth #190

cpsievert opened this issue Mar 18, 2015 · 1 comment
Labels

Comments

@cpsievert
Copy link
Collaborator

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?

@tdhock
Copy link
Contributor

tdhock commented Mar 18, 2015

geom_ribbon has both aes(fill) and aes(color), so if we want to be able to translate both of those to plotly I think we should treat it as a basic polygon (like geom_rect, see #178). To support comparing top and bottom values, I propose that we add an invisible error bar for each ribbon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants