Shortcut to calling `logVals`

, `axis`

and `abline`

1 2 3 4 |

`side` |
Which |

`log` |
Is the axis logarithmic by plot(log="x")? internal DEFAULT: |

`lcol` |
Color of gridlines drawn in the graph with |

`lty, lwd` |
Type of gridlines. DEFAULT: 1 |

`labels` |
Labels passed to |

`allticks` |
Place all intermediate ticklines at the axis (without labelling). DEFAULT: FALSE |

`allargs` |
List of arguments passed to axis for allticks=TRUE. DEFAULT: NULL |

`expr` |
Expression drawing over the ablines, like (points(x,y). Can be code within braces. |

`las` |
LabelAxisStyle for the orientation of the labels. DEFAULT: 1 |

`from` |
Lower exponent OR vector with data, as in |

`to` |
High end exponent. DEFAULT: internally based on par("usr") |

`Range` |
Override from and to as range. |

`base` |
Bases to be used in |

`big.mark` |
Symbol separating thousands, eg. space, comma, dot, etc. see "format" and "prettyNum". DEFAULT: "'" |

`decimal.mark` |
Character separating comma values, see "format" and "prettyNum". DEFAULT: "." |

`scientific` |
See |

`exponent` |
Starting at which exponent should |

`expobase1` |
Should "n * " be appended before 10^exp if n=1? DEFAULT: FALSE |

`allbase` |
base for |

`box` |
Draw box at the end to overplot |

`...` |
Further arguments passed to axis, like |

An invisible list with

`vals` |
Values for lines and label positions |

`labs` |
Formatted values for labels |

`all` |
Values for lines |

Berry Boessenkool, berry-b@gmx.de, Sept 2014

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | ```
x <- 10^runif(200, -1, 2)
plot(x, yaxt="n", log="y", pch=16)
logAxis(2)
# overplot vertical lines:
logAxis(2, expr=points(x, pch=16), base=1, col.axis=4, font=2)
# plots where log="x" is not possible:
hist(log10(x), breaks=20, col.axis="grey", main="")
logAxis(side=3, expr=hist(log10(x), breaks=20, add=TRUE, col=3))
# or just use the new logHist function (Feb 2016):
logHist(x, breaks=20, col=3)
# automatic calculation of from, to and base:
plot(1:3, axes=FALSE)
logAxis(1:2) # side can be a vector - nice, huh?
plot(-1:4, axes=FALSE)
logAxis(1:2) # treshold for base 1 instead of c(1,2,5) at 4 exponents exceeded.
plot(1:3, axes=FALSE)
logAxis(1:2, allticks=TRUE, lcol=NA)
par(mar=c(3,3,1,4))
plot(8:15) ; logAxis(4) # with exponents if they are above 5
plot(10^(1:4), ylim=10^c(4,1), type="o", log="y") # reverse axis:
plot(10^(1:5), log="y"); logAxis(4, exponent=3) # different treshold
plot(10^(1:5), log="y"); logAxis(4, expon=3, base=c(1,2,5), expobase1=TRUE)
plot(-8:5); logAxis(4, allbase=c(1,2,5)) # In case you want to mislead...
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

All documentation is copyright its authors; we didn't write any of that.