geom_scalebar: geom_scalebar

Description Usage Arguments Details Examples

View source: R/geom_scalebar.R

Description

Creates a scale bar in a ggplot

Usage

1

Arguments

range

A vector with two values. Giving the limits in x direction. It doesn't matter which value comes first (if it's not important which colour the first segment has).

y

Value for vertical positioning.

segments

Specifies the number of segments between lower and upper range.

size

Specifies the width of the scale bar.

Details

Uses geom_segment to create a black and white scale bar in horizontal direction. Is not able to give any information about the magnification itself! The exact length of the scale bar has to be known.

Examples

1
2
3
4
5
6
7
8
#rm(list = ls())
ggplot2::ggplot(data = NULL, ggplot2::aes(x = c(2,5), y = c(3, 1))) +
   ggplot2::geom_point() +
   geom_scalebar(range = c(2.5, 4.5), y = 2, segments = 4, size = 2)

ggplot2::ggplot(data = NULL, ggplot2::aes(x = c(2,5), y = c(3, 1))) +
   ggplot2::geom_point() +
   geom_scalebar(range = c(4.5, 2.5), y = 2, segments = 4, size = 2)

reneplonus/ototools documentation built on May 3, 2019, 4:05 p.m.