Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

getFigCoords

Get the figure region as coordinates of the current plot region, or as corrdinates of the figure region.


Description

Get the figure region as coordinates of the current plot region, or as corrdinates of the figure region.

Usage

getFigCoords(input = "f")

Arguments

input

Text string: 'f' (figure, default), 'p' (plot region), 'hf' (half way figure region), or 'hp' (half way plot region)

Value

A vector of the form c(x1, x2, y1, y2) giving the boundaries of the figure region as coordinates of the current plot region.

Author(s)

Jacolien van Rij

See Also

Examples

# setup plot region:
emptyPlot(1,1, bty='o')
fc <- getFigCoords()
pc <- getFigCoords('p')
arrows(x0=pc[c(1,2,1,2)], x1=fc[c(1,2,1,2)],
    y0=pc[c(3,3,4,4)], y1=fc[c(3,3,4,4)], xpd=TRUE)

# Same plot with different axis:
emptyPlot(c(250,500),c(331, 336), bty='o')
fc <- getFigCoords()
pc <- getFigCoords('p')
arrows(x0=pc[c(1,2,1,2)], x1=fc[c(1,2,1,2)],
    y0=pc[c(3,3,4,4)], y1=fc[c(3,3,4,4)], xpd=TRUE)
hc <-  getFigCoords('h')

# other options:
# 1. center of figure region:
abline(v=getFigCoords('hf')[1], col='blue', xpd=TRUE)
abline(h=getFigCoords('hf')[2], col='blue', xpd=TRUE)
# 2. center of plot region:
abline(v=getFigCoords('hp')[1], col='red', lty=3)
abline(h=getFigCoords('hp')[2], col='red', lty=3)

plotfunctions

Various Functions to Facilitate Visualization of Data and Analysis

v1.4
GPL (>= 2)
Authors
Jacolien van Rij [aut, cre]
Initial release
2020-04-30

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.