powered by
Produces a scatter plot of x-y data, with different classes given by a factor f. The different classes are identified by different colours and/or symbols.
plotbyfactor(x, y, f, data, col = 1:10, pch = "O", add = FALSE, lg, xlab = deparse(substitute(x)), ylab = deparse(substitute(y)), log = "", ...)
Variable for x axis.
Variable for y axis.
Factor (or variable for which as.factor() works).
data frame for variables x, y, f. Default: sys.parent().
Color numbers to use in plot. Will be replicated if shorter than the number of levels of the factor f. Default: 1:10.
Vector of plot characters. Replicated if necessary. Default: "O".
If TRUE, add to existing plot. Otherwise, create new plot.
TRUE
Coordinates to place a legend. Default: Missing (no legend).
Axes labels.
Should the axes be in log scale? Use "x", "y", or "xy" to specify which axis to be in log scale.
"x"
"y"
"xy"
Other graphical parameters, labels, titles e.t.c.
data(iris) plotbyfactor(petal.wid, petal.len, species, data=iris)
Run the code above in your browser using DataLab