scale_bar: Enables drawing of a scale bar on a ggplot object, and...

View source: R/legendMap.R

scale_barR Documentation

Enables drawing of a scale bar on a ggplot object, and orientation arrow (optional)

Description

Function from 3wen/legendMap repo for 'adding a North arrow and/or a scale bar to maps done using ggplot2'. All credit for this function goes to Ewen Gallic. All notation and documentation is from Ewen Gallic.

This function Enables drawing of a scale bar on a ggplot object, and orientation arrow (optional). See https://github.com/3wen/legendMap.git for examples. Utilizes create_scale_bar(), and create_orientation_arrow().

Usage

scale_bar(
  lon,
  lat,
  distance_lon,
  distance_lat,
  distance_legend,
  dist_unit = "km",
  rec_fill = "white",
  rec_colour = "black",
  rec2_fill = "black",
  rec2_colour = "black",
  legend_colour = "black",
  legend_size = 3,
  orientation = TRUE,
  arrow_length = 500,
  arrow_distance = 300,
  arrow_north_size = 6
)

Arguments

lon

Longitude of the bottom left point of the first rectangle to draw.

lat

Latitude of the bottom left point of the first rectangle to draw.

distance_lon

Length of each rectangle.

distance_lat

Width of each rectangle.

distance_legend

Distance between rectangles and legend texts.

dist_unit

Units of distance "km" (kilometers) (default), "nm" (nautical miles), "mi" (statute miles).

rec_fill

Filling colour of the first rectangle (default to white).

rec_colour

Colour of the first rectangle (default to black).

rec2_fill

Filling colour of the second rectangle (default to black).

rec2_colour

Colour of the second rectangle (default to black).

legend_colour

Legend colour (default to black).

legend_size

Legend size (default to 3).

orientation

Logical, if TRUE (default), adds an orientation arrow to the plot.

arrow_length

Length of the arrow (default to 500 km).

arrow_distance

Distance between the scale bar and the bottom of the arrow (default to 300 km)

arrow_north_size

Size of the "N" letter (default to 6).

Value

Enables drawing of a scale bar on a ggplot object, and optionally an orientation arrow. Use in ggplot plot code.

Source

https://github.com/3wen/legendMap.git


paulhegedus/OFPE documentation built on Nov. 23, 2022, 5:09 a.m.