Description Usage Arguments Value Examples
A polygon key glyphs for legends of size aesthetics
1 | draw_key_polygon_size(width = 0.8, height = 0.8)
|
width |
A numeric to control the width of keys, which should be between 0 and 1. The default value is 0.8. |
height |
A numeric to control the height of keys, which should be between 0 and 1. The default value is 0.8. |
A Key glyphs function.
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 27 28 29 30 31 32 | library(dplyr)
library(sf)
library(ggplot2)
nc <- sf::st_read(system.file("shape/nc.shp", package = "sf"),
quiet = TRUE)
nc2 <- nc %>% arrange(desc(AREA)) %>% slice(1:2)
ggplot(nc2) +
geom_sf(aes(size = AREA),
colour = "red") +
scale_size(breaks = c(0.24, 0.241)) +
theme(legend.key.size = unit(0.15, "npc"))
ggplot(nc2) +
geom_sf(aes(size = AREA),
colour = "red",
key_glyph = draw_key_polygon_size()) +
scale_size(breaks = c(0.24, 0.241)) +
theme(legend.key.size = unit(0.15, "npc"))
ggplot(nc2) +
geom_sf(aes(size = AREA),
colour = "red",
key_glyph = draw_key_polygon_size(0.9, 0.3)) +
scale_size(breaks = c(0.24, 0.241)) +
theme(legend.key.size = unit(0.15, "npc"))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.