Learn R Programming

DescTools (version 0.99.56)

PlotLog: Logarithmic Plot

Description

The base function grid() does not support logarithmic scales very well. Especially when more lines are required, grids have to be created manually. PlotLog creates a plot with at least one logarithmic axis and places a logarithmic grid in the background of the data.

Usage

PlotLog(x, ..., args.grid = NULL, log = "xy")

Value

nothing

Arguments

x

the coordinates of points in the plot. Alternatively, a single plotting structure, function or any R object with a plot method can be provided.

...

the dots are passed on to the function plot().

args.grid

a list of arguments for the grid. This contains line type, line width and line color, separately for major gridlines and for minor gridlines.
args.grid=list(lwd=1, lty=3, col="grey85", col.min="grey60") are used as default. If the argument is set to NA, no grid will be plotted.

log

a character string which contains "x" if the x axis is to be logarithmic, "y" if the y axis is to be logarithmic and "xy" or "yx" if both axes are to be logarithmic.

Author

Andri Signorell <andri@signorell.net>

See Also

Examples

Run this code
PlotLog(brain ~ body, data=MASS::Animals, log="xy",
        xlim=c(.01, 1e5), ylim=c(.1, 1e4), main="Animal brain/body size",
        pch=21, bg="grey", cex=1.5)

Run the code above in your browser using DataLab