bi_legend {biscale} | R Documentation |
Create Object for Drawing Legend
Description
Creates a ggplot
object containing a legend that is
specific to bivariate mapping.
Usage
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)
Arguments
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 |
Value
A ggplot
object with a bivariate legend.
See Also
Examples
# 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