ggdist icon indicating copy to clipboard operation
ggdist copied to clipboard

Create custom scales / aesthetics for lineribbons

Open mjskay opened this issue 6 years ago • 4 comments

including:

  • [ ] make alpha only apply to ribbons by default (? - might need to remove duplicate lines)
  • [ ] make aesthetics to target alpha on ribbon versus line separately
  • [ ] outline color on ribbons

mjskay avatar Aug 19 '19 02:08 mjskay

Just ran into this problem. I'd like to set ribbon fill, but not the line, semitransparent. Is there a current workaround for this?

ASKurz avatar May 04 '20 14:05 ASKurz

The simplest workaround would probably be to disable the line (color = NA) and then draw the line as a separate geom. That, or you could try assigning a fill color that has an alpha component to it (not 100% sure that would work)

mjskay avatar May 04 '20 15:05 mjskay

Got it. After playing around, this works:

data %>% 
  ggplot(aes(x = x, y = Estimate, ymin = Q2.5, ymax = Q97.5,
             fill = condition, color = condition)) +
  geom_lineribbon() +
  scale_fill_viridis_d(alpha = 1/2) +
  scale_color_viridis_d()

ASKurz avatar May 04 '20 15:05 ASKurz

Awesome! Had no idea the color scales had an alpha argument, that's very useful!

mjskay avatar May 04 '20 15:05 mjskay