qfes / rdeck

Deck.gl widget for R
https://qfes.github.io/rdeck
MIT License
97 stars 0 forks source link

Allow for scaling aesthetic alpha independently of rgb #102

Open anthonynorth opened 10 months ago

anthonynorth commented 10 months ago

Allow for scaling aesthetic alpha channel independently of rgb channels. This would allow for representing feature colours with 2 variables, allowing for emphasising / deemphasising features via alpha.

This is currently only doable via a bit of a hack: set alpha at some low opacity, then replicate features according to some variable. Stacking transparent features makes them more opaque. This works but it's a bit fiddly and makes maps slower.

Possible api:

rdeck() |>
  add_x_layer(
    ...,
    get_fill_color = scale_color_power(foo),
    # fill alpha is linearly scaled by `bar`, to output range [0.5, 1]
    get_fill_color_alpha = scale_linear(bar, limits = c(0.5, 1))
  )