Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

plotbyfactor

x-y scatterplot, colored by levels of a factor.


Description

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.

Usage

plotbyfactor(x, y, f, data, col = 1:10, pch = "O", add = FALSE, lg,
    xlab = deparse(substitute(x)), ylab = deparse(substitute(y)),
    log = "", ...)

Arguments

x

Variable for x axis.

y

Variable for y axis.

f

Factor (or variable for which as.factor() works).

data

data frame for variables x, y, f. Default: sys.parent().

col

Color numbers to use in plot. Will be replicated if shorter than the number of levels of the factor f. Default: 1:10.

pch

Vector of plot characters. Replicated if necessary. Default: "O".

add

If TRUE, add to existing plot. Otherwise, create new plot.

lg

Coordinates to place a legend. Default: Missing (no legend).

xlab, ylab

Axes labels.

log

Should the axes be in log scale? Use "x", "y", or "xy" to specify which axis to be in log scale.

...

Other graphical parameters, labels, titles e.t.c.

Examples

data(iris)
plotbyfactor(petal.wid, petal.len, species, data=iris)

locfit

Local Regression, Likelihood and Density Estimation

v1.5-9.4
GPL (>= 2)
Authors
Catherine Loader [aut], Jiayang Sun [ctb], Lucent Technologies [cph], Andy Liaw [cre]
Initial release
2020-03-24

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.