plotAddLegend {MorphoTools2} | R Documentation |
Add Legend to a Plot
Description
This function can be used to add legend to plot.
Usage
plotAddLegend(result, x = "topright", y = NULL, pch = 16, col = "black",
pt.bg = "white", pt.cex = cex, pt.lwd = 1, x.intersp = 1,
y.intersp = 1, box.type = "o", box.lty = "solid", box.lwd = 1,
box.col = "black", box.bg = "white", cex = 1, ncol = 1, horiz = FALSE, ...)
Arguments
result |
result of |
x , y |
the x and y coordinates or a single keyword from the list |
pch |
the plotting symbols of points appearing in the legend. |
col |
the colours of points appearing in the legend. |
pt.bg |
the background colour for the |
pt.cex |
character expansion factor for the points. |
pt.lwd |
the line width for the points. |
x.intersp , y.intersp |
character interspacing factor for horizontal (x) and vertical (y) line distances. |
box.type |
the type of box to be drawn around the legend. The applicable values are |
box.lty , box.lwd , box.col , box.bg |
the line type, width colour and background colour for the legend box (if |
cex |
character expansion factor for text. |
ncol |
the number of columns in which to set the legend item. |
horiz |
logical; if |
... |
further arguments to be passed to |
Value
None. Used for its side effect of adding elements to a plot.
Examples
data(centaurea)
centaurea = naMeanSubst(centaurea)
centaurea = removePopulation(centaurea, populationName = c("LIP", "PREL"))
pcaRes = pca.calc(centaurea)
plotPoints(pcaRes, col = c("red", "green", "blue", "red"),
pch = c(20, 17, 8, 21), pt.bg = "orange", legend = FALSE)
plotAddLegend(pcaRes, x = "bottomright", col = c("red", "green", "blue", "red"),
pch = c(20, 17, 8, 21), pt.bg = "orange", ncol = 2)