Learn R Programming

adegraphics (version 1.0-5)

addtext: Adds labels on graphics.

Description

Adds a trellis object containing one or several labels on one or several graphical objects.

Usage

addtext(object, xcoord, ycoord, label, which = 1, plot = TRUE, pos = -1, ...)

Arguments

object
an object of class ADEg, ADEgS or trellis
xcoord
an integer (or a vector) indicating where label is(are) plotted on the x-axis
ycoord
an integer (or a vector) indicating where label is(are) plotted on the y-axis
label
a character string (or a vector) containing the label(s) displayed on object
which
if object is an ADEgS, which ADEg is used as the base of superposition
plot
a logical indicating if the graphics is displayed
pos
an integer indicating the position of the environment where the data are stored, relative to the environment where the function is called. Useful only if storeData is FALSE
...
Additional graphical parameters (see the plabels list in adegpar and trellis.par.get)

Value

An object of class "ADEgS".

See Also

ADEg ADEgS

Examples

Run this code
data(dunedata, package = "ade4")
afc1 <- ade4::dudi.coa(dunedata$veg, scannf = FALSE)
g1 <- table.value(dunedata$veg, symbol = "circle", ppoints.cex = 0.5, plot = FALSE)
addtext(g1, 1, 20, "A", plabels.srt = 45)

xy <- cbind.data.frame(x = runif(200, -1, 1), y = runif(200, -1, 1))
posi <- factor(xy$x > 0) : factor(xy$y > 0)
g2 <- s.class(xy, fac = posi, facets = posi, pellipses.col = 1:4, plabels.cex = 0, 
  plegend.drawKey = FALSE, psub.cex = 0, plot = FALSE)
addtext(g2, c(0.5, 0.5, -0.5, -0.5), c(0.5, -0.5), levels(posi), plabels.cex = 2, plabels.col = 1:4)

Run the code above in your browser using DataLab