Skip to content

Commit

Permalink
moves the colour setting in style_ribbon() to an unexported function
Browse files Browse the repository at this point in the history
  • Loading branch information
djnavarro committed Dec 27, 2019
1 parent eae7a25 commit 695e773
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions R/style_ribbon.R
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,8 @@ style_ribbon <- function(
ribbon$yend <- ribbon2$yend
ribbon$order <- ribbon2$order

#return(ribbon)

# get colour values
col_set <- palette(n = max(ribbon$order))
# generate colour set
col_set <- colours_from(palette, ribbon$order)

# create basic object
pic <- ggplot2::ggplot(
Expand Down Expand Up @@ -138,6 +136,14 @@ style_ribbon <- function(
return(pic)
}

# colours_from <- function(palette, order, ...) {
# palette(n = max(order)) # original
# }


colours_from <- function(palette, order, ...) {
palette(n = length(unique(order)))
}

# # fill in the seed shape if requested
# if(!is.null(seed_fill)) {
Expand Down

0 comments on commit 695e773

Please sign in to comment.