add.log.axis | R Documentation |
This function provides special support for adding superior looking base-10 logarithmic axes relative to R's defaults, which are an embarassment. The Examples section shows an overly elaborate version made by repeated calls to this function with a drawback that each call redraws the line of the axis so deletion in editing software might be required. This function is indexed under the “lmomco functions” because of its relation to add.lmomco.axis
and is not named add.lmomcolog.axis
because such a name is too cumbersome.
add.log.axis(make.labs=FALSE, logs=c(2, 3, 4, 5, 6, 7, 8, 9), side=1,
two.sided=FALSE, label=NULL, x=NULL, col.ticks=1, ...)
make.labs |
A logical controlling whether the axis is labled according to the values in |
logs |
A numeric vector of log-cycles for which ticking and (or) labeling is made. These are normalized to the first log-cycle, so a value of |
side |
An integer specifying which side of the plot the axis is to be drawn on, and argument corresponds the axis side argument of the |
two.sided |
A logical controlling whether the side oppose of |
label |
The label (title) of the axis, which is placed by a call to function |
x |
This is an optional data vector (untransformed!), which will compute nice axis limits and return them. These limits will align with (snap to) the integers within a log10-cycle. |
col.ticks |
This is the same argument as the |
... |
Additional arguments to pass to |
No value is returned, except if argument x
is given, for which nice axis limits are returned. By overall design, this function is used for its side effects.
W.H. Asquith
add.lmomco.axis
## Not run:
par(mgp=c(3,0.5,0)) # going to tick to the inside, change some parameters
X <- 10^sort(rnorm(65)); pp <- pp(X) # generate synthetic data
ylim <- add.log.axis(x=X) # snap to some nice integers within the cycle
plot(qnorm(pp), X, xaxt="n", yaxt="n", xlab="", ylab="", log="y",
xlim=c(-2,3), ylim=ylim, pch=6, yaxs="i", col=4)
add.lmomco.axis(las=2, tcl=0.5, side.type="RI", otherside.type="NPP")
# Logarithmic axis: the base ticks to show logarithms
add.log.axis(side=2, tcl=0.8*abs(par()$tcl), two.sided=TRUE)
# the long even-cycle tick, set to inside and outside
add.log.axis(logs=c(1), tcl=-0.5*abs(par()$tcl), side=2, two.sided=TRUE)
add.log.axis(logs=c(1), tcl=+1.3*abs(par()$tcl), side=2, two.sided=TRUE)
# now a micro tick at the 1.5 logs but only on the right
add.log.axis(logs=c(1.5), tcl=+0.5*abs(par()$tcl), side=4)
# and only label the micro tick at 1.5 on the right
add.log.axis(logs=c(1.5), side=4, make.labs=TRUE, las=3) # but weird rotate
# add the bulk tick labeling and axis label.
add.log.axis(logs=c(1, 2, 3, 4, 6), side=2, make.labs=TRUE, las=1, label="QUANTILE")
par(mgp=c(3,1,0)) # restore defaults
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.