Skip to content

Commit

Permalink
col accepts numeric index (#330)
Browse files Browse the repository at this point in the history
* col = <numeric>
  • Loading branch information
grantmcdermott authored Feb 28, 2025
1 parent 1ed0696 commit 4913bd6
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions R/by_aesthetics.R
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,11 @@ by_col = function(ngrps = 1L, col = NULL, palette = NULL, gradient = NULL, order
}
if (isTRUE(gradient)) {
col = rev(col)
} else if (!ordered && is.numeric(col)) {
col = palette()[col]
}
if (anyNA(col) || is.character(col)) {
if (alpha) col = adjustcolor(col, alpha.f = alpha)
return(col)
}
}
Expand Down

0 comments on commit 4913bd6

Please sign in to comment.