create_scale_bar: Create a scale bar

View source: R/legendMap.R

create_scale_barR Documentation

Create a scale bar

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 creates a scale bar. See https://github.com/3wen/legendMap.git for examples.

Usage

create_scale_bar(
  lon,
  lat,
  distance_lon,
  distance_lat,
  distance_legend,
  dist_units = "km"
)

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_units

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

Value

Return a list whose elements are; 'rectangle': a data.frame containing the coordinates to draw the first rectangle, 'rectangle2': a data.frame containing the coordinates to draw the second rectangle, and 'legend': a data.frame containing the coordinates of the legend texts, and the texts as well.

Source

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


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