Aspect Ratio Computations for Banking
USAGE:
banking(dx, dy, iter=20, tolerance=0.5)
ARGUMENTS:
- dx
-
change in
x
for a vector of line segments.
- dy
-
change in
y
for a vector of line segments.
- iter
-
maximum number of iterations allowed.
- tolerance
-
if the iterations produce an average angle within
tolerance
of 45 degrees, the function returns.
VALUE:
numeric value giving the aspect ratio of a plot that would
bank the given
dx
and
dy
values close to 45 degrees.
The average slope computation
is weighted by the lengths of the segments.
EXAMPLES:
# this gives the same result as xyplot(y ~ x ,aspect = "xy")
x <- gas$E
y <- gas$NOx
o <- order(x)
dx <- diff(x[o])
dy <- diff(y[o])
xyplot(y ~ x ,aspect = banking(dx/diff(range(x)),dy/diff(range(y))))