Skip to content

Commit

Permalink
Merge pull request #146 from jwolfson/master
Browse files Browse the repository at this point in the history
Improve handling of gradients argument in addHeatmap
  • Loading branch information
trafficonese authored Apr 2, 2024
2 parents ebb7bcb + c6da2ab commit a3f7a9c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions R/heatmap.R
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,10 @@ addHeatmap <- function(
)

# convert gradient to expected format from leaflet
if (!is.null(gradient) && !is.function(gradient)) {
gradient <- colorNumeric(gradient, 0:1)
if (!is.null(gradient)) {
if (!is.function(gradient)) {
gradient <- colorNumeric(gradient, 0:1, alpha = TRUE)
}
gradient <- as.list(gradient(0:20 / 20))
names(gradient) <- as.character(0:20 / 20)
}
Expand Down

0 comments on commit a3f7a9c

Please sign in to comment.