-
Notifications
You must be signed in to change notification settings - Fork 2
/
legend_sequential.R
26 lines (22 loc) · 1.14 KB
/
legend_sequential.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#' @title legend_sequential
#'
#' @description Create a qualitative legend. `legend_scale`` accepts scales listed in [d3-scale](https://github.com/d3/d3-scale#continuous-scales).
#'
#' @param variable_name string, name of the variable of this legend.
#' @param legend_scale string, type of legend scale, must be the name of a d3 scale. Default: "scaleLinear".
#' @param color_low string, color for the lowest value of the legend.
#' @param color_high string, color for the highest value of the legend.
#' @param color_no_data string, color for no data entries.
legend_sequential <- function(variable_name,
legend_scale='scaleLinear',
color_low='white',
color_high='green',
color_no_data='lightgrey'){
legend <- list('variable_name' = variable_name,
'legend_type' = 'sequential',
'legend_scale' = legend_scale,
'legend_values' = list('low'=color_low,
'high'=color_high,
'No Data'=color_no_data))
return(legend)
}