extend_ranges: Extend the range of data by an amount

Description Usage Arguments Value Author(s) Examples

View source: R/utils.R

Description

This is useful for setting a margin in the plot region.

Usage

1
extend_ranges(x, f = qpar("mar"))

Arguments

x

the data vector (either the orginal vector or its range) or an n by 2 matrix which is used to define the ranges of two axes in two columns

f

the amount to extend the range (usually a scalar; when it is a vector, its length must be 2 (giving the amount to extend to the left and right respectively) or 4 (extending x-axis and y-axis respectively)

Value

a vector or a matrix of ranges corresponding to the input x

Author(s)

Yihui Xie

Examples

1
2
3
4
5
6
7
8
9
extend_ranges(c(0, 1))
extend_ranges(1:10)

m <- matrix(c(c(1, 5, 10), c(5, 7, 8)), ncol = 2)
extend_ranges(m)
# larger top and right margins
extend_ranges(m, f = c(0.1, 0.2))
# larger horiz margins, small vertical margins
extend_ranges(m, f = c(0.2, 0.2, 0.1, 0.1))

ggobi/cranvas documentation built on May 17, 2019, 3:10 a.m.