aplot: Scientific X-Y Plotting

Description Usage Arguments Details Note Author(s) See Also Examples

Description

Generic function for plotting of R objects.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
aplot(x, y = NULL, z = NULL, xlim = NULL, ylim = NULL, zlim = NULL, 
      xlab = NULL, ylab = NULL, zlab = NULL, col = NULL, axes = TRUE, 
      side = 1:4, labels = TRUE, majticks = TRUE, minticks = TRUE, 
      nxmaj = NULL, nymaj = NULL, nxmin = NULL, nymin = NULL, xat = NULL, 
      yat = NULL, log = "", unlog = FALSE, xformat = NULL, yformat = NULL, 
      digits = 0, cex = 1, xlabpos = 1, ylabpos = 2, zcol = NULL, 
      cb = FALSE, cbpos = 4, cbsep = 1.5, cbspan = 2, cbinset = 1, 
      cbx1 = NULL, cbx2 = NULL, cby1 = NULL, cby2 = NULL, cblegend = NULL, 
      cbsteps = 250, las = 0, mgp = c(2.5,0.5,0), tcl = 0.5, dexcl = 0.2, 
      cex.axis = 1, cex.cb = 1, zline = mgp[1]+1, col.axes = "black", 
      col.axis = "black", add = FALSE, type = NULL, bgcol = NULL, ...)

Arguments

x,y,z

the 'x', 'y' and 'z' arguments provide the x, y and z coordinates for the plot. Supplying the 'z' argument will colour each data point differently according to its z value.

xlim,ylim,zlim

the x, y and z limits of the plot in the form c(lower,upper)

xlab,ylab,zlab

the x, y and z axis labels

col

colour of the data points (will override z)

axes

plot axes

side

sides to plot axes [T/F or 1:4]

labels

sides to plot axes labels [T/F or 1:4]

majticks

plot major tick marks

minticks

plot minor tick marks

nxmaj

number of major tick marks on the x-axis

nymaj

number of major tick marks on the y-axis

nxmin

number of minor tick marks between major ticks (x)

nymin

number of minor tick marks between major ticks (y)

xat

position of x-axes major tick marks

yat

position of y-axes major tick marks

log

logged axes

unlog

unlog axes plotting logged data

xformat

format for x-axes labelling (see 'formatC')

yformat

format for y-axes labelling (see 'formatC')

digits

number of digits for axes labels

cex

expansion factor

xlabpos

label position (x)

ylabpos

label position (y)

zcol

z-axis colour palette

cb

plot colourbar

cbpos

position of colourbar

cbsep

separation of colourbar from plot

cbspan

width/height of colourbar

cbinset

size of inset of colourbar on axis parallel to plotting side

cbx1,cbx2,cby1,cby2

manual colourbar positioning (xlower, xupper, ylower, yupper

cblegend

colourbar legend

cbsteps

colourbar resolution

las,mgp,tcl

standard 'par' plotting parameters

dexcl

distance from major tick marks within which no minor tick labels should be plotted

cex.axis

expansion factor for axis annotation

cex.cb

expansion factor for colourbar annotation

zline

colourbar label line

col.axes

colour of axes

col.axis

colour of axes annotation

add

add the plot to an existing plot

type

plot type

bgcol

background colour

...

additional arguments to be passed to 'plot'

Details

The top-level function 'aplot' (astro:plot) is a wrapper around the R function 'plot'. It provides significant additional features which trivially allow the creation of figures more suited for a scientific audience. Notably, 'aplot' allows z-axis information to be displayed through the use of colourbars and provides improved axes (including minor-tick marks) through the use of the 'aaxis' function.

Note

Colourbar features are provided by the 'color.legend' function within the 'plotrix' package (author: Jim Lemon). 'aplot' provides a wrapper around this function, therefore, in order for colourbar features to function correctly, the 'plotrix' package must be installed.

Author(s)

Lee Kelvin <lee.kelvin@uibk.ac.at>

See Also

The astronomy package: astro.

Examples

 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
28
29
30
31
32
33
34
35
36
37
38
39
# example #1
layout(1)
par("mar"=c(5.1,4.1,2.1,2.1))
par("oma"=c(0,0,0,0))
aplot(sin, xlim=c(0,2*pi), ylim=c(-1.1,1.1), bgcol="lightgoldenrodyellow")
abline(h=0, col="grey75")
label("top", txt="Sine Function", lwd=0, bgcol="grey25", col="white")
label("bottomleft", txt="astro:label (label)", cex=2, lwd=0, bgcol=NULL)

# example #2
layout(1)
par("mar"=c(5.1,4.1,2.1,4.1))
par("oma"=c(0,0,0,0))
aplot(1:1000, log10(1:1000), unlog="y", type="l", yformat="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)

# example #3
layout(cbind(c(1,2),c(3,3)), widths=c(5,1))
par("mar"=c(0,0,0,1))
par("oma"=c(3.1,3.1,3.1,2.1))
aplot(rnorm(1000), rnorm(1000), rnorm(1000), pch=17, zlim=c(-1,1), xlim=c(-3,3), 
ylim=c(-3,3), labels=2:3)
grid()
label("topleft", txt="astro:colourbar (acb)", cex=2, lwd=0, bgcol=NULL)
aplot(rnorm(1000), rnorm(1000), rnorm(1000), pch=16, zlim=c(-1,1), xlim=c(-3,3), 
ylim=c(-3,3), labels=1:2)
grid()
acb(zlim=c(-1,1), zlab="z-axis label")

# example #4
layout(1)
par("mar"=c(5.1,4.1,4.1,5.1))
par("oma"=c(0,0,0,0))
aplot(rnorm(1000), rnorm(1000), rnorm(1000), cb=TRUE, zlim=c(-1,1), pch=16, 
xlab="x-axis label", ylab="y-axis label", zlab="z-axis label", bgcol="grey95")
label("topleft", txt="astro:plot (aplot)", cex=2, lwd=0, bgcol=NULL)

taranu/astro documentation built on May 23, 2019, 7:36 a.m.