Plot a legend independently of a map
Usage
plot_legend(dataset_legend, path = NULL, horiz = TRUE, add = FALSE)
Arguments
- dataset_legend
list of parameters to be passed to legend
- path
character, the name of the file to save the plot. Graphical
device is chosen depending on extension. See details.
- horiz
logical, should the legend be horizontal
- add
logical, should the legend be added to the current plot
Details
path specification
Depending on the extension a device is chosen.
If path is NULL, standard plotting is used. If an extension is not managed,
an error is raised.
Examples
dataset_legend = list(
title = "Beatutiful legend",
legend = c("red circle", "black square", "blue diamond"),
pch = 21:23,
pt.bg = c("red", "black", "blue")
)
plot_legend(dataset_legend)
plot_legend(dataset_legend, horiz = FALSE)