legend_divergingBins | R Documentation |
Create legend for diverging bins representing two parties.
legend_divergingBins(list_pal, labels, title = NULL, width = 200)
list_pal |
a named list of equal-length color vectors. Each vector consists of color codes. And the name of the vector represents the party name. |
labels |
a character vector for labeling colors, should have the same length as any one color vector in 'list_pal' |
title |
title for the legend |
colorspace::diverging_hcl(n = 10, h = c(245, 120), c = c(31, 100), l = c(30, 100), power = c(1, 1.3), register = "kmt-dpp") -> pal
list_pal = list(
"國民黨"=rev(pal[1:5]),
"民進黨"=pal[6:10]
)
labels=c("0-50","50-55","55-60","60-65","65-100%")
legend_divergingBins(list_pal, labels, title=NULL)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.