Skip to content
Please note that GitHub no longer supports your web browser.

We recommend upgrading to the latest Google Chrome or Firefox.

Learn more
Permalink
Browse files

style_ribbon lets user specify name of colour aesthetic

  • Loading branch information
djnavarro committed Dec 31, 2019
1 parent 6329f91 commit b0f962a8557efe90c2e87cd7a8dcdc9a808a442a
Showing with 11 additions and 0 deletions.
  1. +3 −0 R/style_ribbon.R
  2. +5 −0 docs/reference/style_ribbon.html
  3. +3 −0 man/style_ribbon.Rd
@@ -5,6 +5,7 @@
#' @param discard how many iterations should we discard before drawing?
#' @param alpha length two numeric, first element is the initial alpha, (optional) second is the decay rate for alpha
#' @param palette function generating a palette (or string naming the palette)
#' @param colour name of variable to use to specify the colour aesthetic
#' @param background colour of the background in the plot
#' @param type type of geom to use ("segment", "curve" or "point")
#' @param ... arguments to pass to geom
@@ -14,6 +15,7 @@
style_ribbon <- function(
data,
palette = "viridis", # function to generate palette (args: n, alpha)
colour = "order", # name of column to use as the colouring
alpha = c(.3, 0), # initial transparency and decay
background = "black",
discard = 0, # how many of the iterations do we not draw?
@@ -22,6 +24,7 @@ style_ribbon <- function(
) {

ribbon <- data
ribbon$order <- ribbon[[colour]]

# use named paletee if the input is character
if(is.character(palette)) {

Some generated files are not rendered by default. Learn more.

Some generated files are not rendered by default. Learn more.

0 comments on commit b0f962a

Please sign in to comment.
You can’t perform that action at this time.