bi_legend | R Documentation |
Creates a ggplot
object containing a legend that is
specific to bivariate mapping.
bi_legend(pal, dim = 3, xlab, ylab, size = 10, flip_axes = FALSE, rotate_pal = FALSE, pad_width = NA, pad_color = "#ffffff", breaks = NULL, arrows = TRUE, base_family = "sans")
pal |
A palette name or a vector containing a custom palette. See
the help file for |
dim |
The dimensions of the palette. To use the built-in palettes,
this value must be either If you are using a custom palette, this value may be larger (though these
maps can be very hard to interpret). See the 'Advanced Options' vignette
for details on the relationship between |
xlab |
Text for desired x axis label on legend |
ylab |
Text for desired y axis label on legend |
size |
A numeric scalar; size of axis labels |
flip_axes |
A logical scalar; if |
rotate_pal |
A logical scalar; if |
pad_width |
An optional numeric scalar; controls the width of padding between tiles in the legend |
pad_color |
An optional character scalar; controls the color of padding between tiles in the legend |
breaks |
An optional list created by |
arrows |
A logical scalar; if |
base_family |
A character string; by default, it is set to |
A ggplot
object with a bivariate legend.
bi_pal
# sample 3x3 legend legend <- bi_legend(pal = "GrPink", dim = 3, xlab = "Higher % White ", ylab = "Higher Income ", size = 16) ## print legend legend # sample 3x3 legend with breaks ## create vector of breaks break_vals <- bi_class_breaks(stl_race_income, style = "quantile", x = pctWhite, y = medInc, dim = 3, dig_lab = c(x = 4, y = 5), split = TRUE) ## create legend legend <- bi_legend(pal = "GrPink", dim = 3, xlab = "Higher % White ", ylab = "Higher Income ", size = 16, breaks = break_vals, arrows = FALSE) ## print legend legend # sample 3x3 legend with Chinese characters ## set language preference showtext::showtext_auto() ## create legend legend <- bi_legend(pal = "GrPink", dim = 3, xlab = "白人 ", ylab = "收入 ", size = 16, base_family = "") ## print legend legend
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.