Learn R Programming

OrdinalLogisticBiplot (version 0.4)

BiplotDensity: Density plot of a data set with overlaid contours.

Description

This function draws for a set of points a density contour lines plot. The densities can be calculated for the whole set of points or for the groups defined by a nominal variable.

Usage

BiplotDensity(X, y = NULL, nlevels = max(y), grouplabels = 1:nlevels, ncontours = 6, groupcols = 1:nlevels, img = TRUE, separate = FALSE, ncolors = 20, ColorType = 4, xliml = -1, xlimu = 1, yliml = -1, ylimu = 1, plotInd = FALSE)

Arguments

X
A matrix with the coordinates for the plane in which the the contour lines will be plotted.
y
Categorical variable used for defining clusters. If NULL, the density is calculated for the whole set of points.
nlevels
Number of clusters.
grouplabels
Set of labels for the centers of each cluster. It should be a vector with "nlevels" components.
ncontours
Number of contours that will be used in the representation.
groupcols
Vector whith a set of colors for the clusters.
img
Should the density be plotted (with different colors) together with the contour lines?. Default value is TRUE.
separate
Should the density for each cluster be represented on a different picture?. Default value is FALSE.
ncolors
Number of colors for the densities.
ColorType
Type of color schema for the density image. It should be a number between 1 and 5.
xliml
Minimum value on the x-axis.
xlimu
Maximum value on the x-axis.
yliml
Minimum value on the y-axis.
ylimu
Maximum value on the y-axis.
plotInd
Should the individuals be plotted?

Examples

Run this code
data(LevelSatPhd)
olbo = OrdinalLogisticBiplot(LevelSatPhd)
x = olbo$RowCoords[, 1]
y = olbo$RowCoords[, 2]
plot(x,y, cex = 0, xlim=c(-1,1),ylim=c(-1,1))
X = olbo$RowCoords
y = as.matrix(as.numeric(LevelSatPhd[,4]))
gcols = c("midnightblue","black","red","gray87")
BiplotDensity(X,y,groupcols = gcols)

Run the code above in your browser using DataLab