Learn R Programming

berryFunctions (version 1.4)

linLogTrans: Animation for transition from linear to logarithmic axis

Description

make images that gradually transform from a linear to a logarithmic axis

Usage

linLogTrans(x, y, log="x", steps=100, base=1, firstplot=TRUE, lastplot=TRUE, 
write_t=TRUE, values_t=NULL, pointsarg=NULL, ...)

Arguments

x
x values to be plotted in animation
y
vector with corresponding y values
log
which axis is logarithmic, "x" or "y". DEFAULT: "x"
steps
Approximate number of steps (images) in transition (About 30% are taken out). DEFAULT: 100
base
base passed to logVals. DEFAULT: 1
firstplot
Plot data on linear axis as first image? DEFAULT: TRUE
lastplot
Plot data on logarithmic axis as last image? DEFAULT: TRUE
write_t
write transformation value in lower right corner? DEFAULT: TRUE
values_t
Supply vector with values for transformation (1/t). Overides steps. If you have a better algorithm than I do, please let me know! DEFAULT: NULL for internal calculation based on size of steps.
pointsarg
List of further arguments passed to points, like pch, cex, col. DEFAULT: NULL
...
further arguments passed only to plot, like main, xlim, ylab. Excluded: x, y, las, xaxt, type

Value

  • returned invisibly: transformation values used. Plotted: steps number of images.

References

x^(1/t) is based on the first comment on http://stackoverflow.com/questions/15994442/ besides the nice graphic properties, check this page for the implications on rates of change: http://sfew.websitetoolbox.com/post/show_single_post?pid=1282690259&postcount=4 http://sfew.websitetoolbox.com/post/show_single_post?pid=1282691799&postcount=5

See Also

logVals

Examples

Run this code
set.seed(42);  x <- 10^rnorm(100, 3);  y <- runif(100)
linLogTrans(x,y, steps=15)


## Rcmd check --as-cran doesn't like to open external devices such as pdf,
## so this example is excluded from running in the checks.
pdf("LinLogTransitionAnimation.pdf")
linLogTrans(x,y, main="Example Transition")
dev.off()

Run the code above in your browser using DataLab