Rounded legends for SOmap

SOleg(
  x = NULL,
  position = "topright",
  col = NULL,
  ticks = NULL,
  tlabs = NULL,
  breaks = NULL,
  trim = -45,
  type = "discrete",
  label = "",
  ladj = 0.5,
  lsrt = 0,
  lcex = 0.75,
  tadj = 0.5,
  tcex = 1,
  rnd = NULL,
  border_width = 2
)

Arguments

x

numeric: object to obtain min and max values from for type = "continuous".

position

string: where you want the legend ("topleft", "topright", "bottomleft", or "bottomright").

col

character: colours to use.

ticks

numeric: number of ticks to include on the legend. Only used with type = "continuous".

tlabs

character: tick labels. Required for type = "discrete", optional for type = "continuous" if x is given.

breaks

numeric: vector of tick positions for type = "continuous" when x is given.

trim

numeric: trim value that was used to create the SOmap object (see SOmap).

type

string: type of legend ("discrete" or "continuous").

label

string: legend label.

ladj

numeric: distance to adjust the tick labels from the ticks.

lsrt

numeric: angle of the tick labels.

lcex

numeric: size of the tick labels.

tadj

numeric: distance to adjust the title from the ticks.

tcex

numeric: size of the title text.

rnd

numeric: optional rounding factor for continuous legends using the link{round} function.

border_width

numeric: thickness (in degrees of latitude) of the border.

Value

An object of class "SOmap_legend". Printing or plotting this object will cause it to be added to the SOmap in the current graphics device.

Examples

if (FALSE) { # \dontrun{
  SOmap()

  ## Discrete Legend
  SOleg(position = "topleft", col = hcl.colors(5, "Viridis"),
        tlabs = c("a", "b", "c", "d", "e"), trim = -45, label = "Species")

  ## Continuous Legend
  SOleg(x = runif(100), position = "topright", col = hcl.colors(80, "Viridis"),
        breaks = c(0.1, 0.2, 0.5, 0.9), trim = -45, label = "Species",
        rnd = 1, type = "continuous")
} # }