Free Access Week-  Data Engineering + BI
Data engineering and BI courses are free!
Free AI Access Week from June 2-8

astro (version 1.2)

aaxis: Add a Scientific Axis to a Plot

Description

Adds an axis to the current plot.

Usage

aaxis(side = 1, at = NULL, labels = TRUE, majticks = TRUE, minticks = TRUE, nmaj = NULL, nmin = NULL, unlog = FALSE, format = NULL, digits = NULL, las = NULL, mgp = NULL, tcl = NULL, dexcl = 0.2, ...)

Arguments

side
an integer specifying which side of the plot the axis is to be drawn on. The axis is placed as follows: 1=below, 2=left, 3=above and 4=right
at
the points at which the major tick-marks are to be drawn
labels
should axis annotation be added
majticks
should major tick marks be included
minticks
should minor tick marks be included
nmaj
number of major tick marks
nmin
number of minor tick marks between major marks
unlog
unlog axis annotation when the data is logged (base 10)
format
format for axes labelling (see 'formatC')
digits
number of digits for axes labels
las,mgp,tcl
standard 'par' plotting parameters
dexcl
distance from major tick marks within which no minor tick labels should be plotted
...
additional arguments to be passed to 'axis'

Details

The mid-level function 'aaxis' (astro:axis) is a wrapper around the R function 'axis'. It provides significant additional features which trivially allow the creation of figures more suited for a scientific audience. Notably, 'aaxis' allows minor tick-marks and logged axes to be created with the minimum of effort.

See Also

The astronomy package: astro.

Examples

Run this code
par("mar"=c(5.1,4.1,2.1,4.1))
aplot(1:1000, log10(1:1000), unlog="y", type="l", format="p", side=1:3, col="red", lwd=2)
aaxis(4, nmaj=4, nmin=9)
mtext(bquote(paste(log[10]," y ")), side=4, line=2.5)
label("bottomright", txt="astro:axis (aaxis)", cex=2, lwd=0, bgcol=NULL)

Run the code above in your browser using DataLab