parasp: Set up aspect ratio

Description Usage Arguments Value Author(s) See Also Examples

Description

Set aspect ratio match data matrix or given aspect ratio The par("pin") graphics parameter is adjusted to meet the requested aspect ratio within a chosen tolerance.

Usage

1
parasp(dat, aspr = dim(dat)[1]/dim(dat)[2], tol = 0.01)

Arguments

dat

A matrix to be used as a template to define aspr

aspr

Required aspect ratio

tol

Tolerance for par("pin")

Value

pin

Old parameters from par("pin")

Author(s)

G. Sawitzki

See Also

par

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
 parasp(aspr=sqrt(2))	# set to harmonic ratio
 xx <- matrix(ncol=4,nrow=5); parasp(xx)	# set to match row/col ration in xx
## The function is currently defined as
function(dat, aspr=dim(dat)[1]/dim(dat)[2], tol=0.01)
{	if (aspr<= 0) stop("parasp: aspr must be positive")
	pin<-par("pin")
	ar <- pin[1]/pin[2]
	if (abs(ar/aspr)>tol) {
		if (ar < aspr) 
			pin[2] <- pin[1]/aspr  else pin[1] <- pin[2]* aspr
		par(pin=pin)
	}
  }


Search within the bertin package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.