Description Usage Arguments Details Value Author(s) See Also Examples
Scatterplot with logarithmic axes and gridlines.
1 2 3 4 5 6 7 8 9 10 11 12 |
x, y |
vectors of x- and y-axis values |
xlim, ylim |
numeric vectors of length 2, giving x,y ranges on linear scale |
xlog, ylog |
logical, should x,y axes be log-transformed? In case the linear scale is chosen, no gridlines are drawn. |
xbase, ybase |
numeric, base of the logarithm of the respective axes. Ignored if linear axis is specified. |
grdcol |
single value, color to be used for logarithmic gridlines |
... |
further arguments passed to other methods |
Emulates classic log-log graph paper. X and Y axes controlled independently. Points may be added post-hoc.
A plot object
Petr Kiel
Lightly modified from http://www.petrkeil.com/?p=2701
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | # compare linear vs logarithmic axes
par(mfrow=c(1,2))
x <- seq(1, 1000, by=10)
plot(x, x, ylim=c(0,4000), las=1, bty='l')
points(x, x^0.8, col='blue')
points(x, x^1.2, col='red')
plot_loglog(x=log10(x), y=log10(x), xlab='X axis', ylab='Y axis',
ylim=c(1, 10000), pch=16, col='#00000030')
points(log10(x), 0.8*log10(x), pch=16, col='#0000FF30')
points(log10(x), 1.2*log10(x), pch=16, col='#FF000030')
# one axis log, one axis linear
x <- 1:1000
y <- dlnorm(x, meanlog=4)
yl <- c(0,0.012)
plot(x, y, ylim=yl, ylab='Pr density', bty='l', las=1)
plot_loglog(log10(x), y, ylog=FALSE, ylim=yl, xlim=c(0.1,1000),
ylab='Pr den', pch=16, col='#00000030')
par(mfrow=c(1,1))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.