| linLogHist | R Documentation | 
Draw histograms that gradually transform from a linear to a logarithmic axis (animation)
linLogHist(
  x,
  steps = 100,
  breaks = 20,
  col = "blue",
  las = 1,
  xlab = deparse(substitute(x)),
  xlim = range(x, finite = TRUE),
  box = TRUE,
  parexpr,
  endexpr,
  sleep = 0,
  axisargs = NULL,
  axisargs2 = NULL,
  firstplot = TRUE,
  lastplot = TRUE,
  write_t = TRUE,
  values_t = NULL,
  ...
)
| x | x values to be plotted in animation | 
| steps | Number of steps in transition. DEFAULT: 100 | 
| breaks | 
 | 
| col | 
 | 
| las | 
 | 
| xlab | Label for the x axis. DEFAULT: deparse(substitute(x)) | 
| xlim | xlim range in non-log units. DEFAULT: range(x, finite=TRUE) | 
| box | Draw box at the end to overplot  | 
| parexpr | Characterized Expression to set  | 
| endexpr | Characterized Expression executed at the end of the plot, eg.  | 
| sleep | Pause time between frames, in seconds, passed to  | 
| axisargs | List of arguments passed to  | 
| axisargs2 | List of arguments passed to  | 
| firstplot | plot on linear scale first? DEFAULT: TRUE | 
| lastplot | plot on logarithmic scale at the end? DEFAULT: TRUE | 
| write_t | write transformation value in lower right corner? DEFAULT: TRUE | 
| values_t | Supply vector with values for transformation (1/t). Overrides steps. If you have a better algorithm than I do, please let me know! DEFAULT: NULL | 
| ... | further arguments passed to  | 
Returned invisibly: transformation values used. Plotted: steps number of images.
It's best to save the plots into a pdf or wrap it within
png("Transition%03d"); linLogHist(x); dev.off()
Berry Boessenkool, berry-b@gmx.de, April 2015
linLogTrans
x <- rlnorm(700, m=3)
hist(x, col=4)
hist(log10(x), xaxt="n"); logAxis(1); hist(log10(x), col=4, add=TRUE)
op <- par()
linLogHist(x, steps=8, sleep=0.01) # 0.05 might be smoother
linLogHist(x, xlab="ddd", breaks=30, steps=3, write_t=FALSE, yaxt="n", freq=FALSE,
   main="", parexpr='par(mar=c(2,0.5,1.5,0.5), mgp=c(1.8,1,0))',
   endexpr='mtext("Probability Density", line=-1.2, adj=0.03, outer=T)')
par(op)
## Not run: 
## 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")
linLogHist(x, main="Example Transition", steps=20, freq=FALSE)
dev.off()
# if you have FFmpeg installed, you can use the animation package like this:
library2(animation)
saveVideo(linLogHist(x, steps=50), video.name="linlog_anim.mp4", interval=0.08,
ffmpeg="C:/ffmpeg-20150424-git-cd69c0e-win64-static/bin/ffmpeg.exe")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.