greenplot: Plot Statistics for a Greenclust Object

View source: R/greenplot.R

greenplotR Documentation

Plot Statistics for a Greenclust Object

Description

Displays a connected scatterplot showing the r-squared values (x-axis) and p-values (y-axis) at each clustering step of a greenclust object. Points are labeled with their cutpoints, i.e., the number of groups/clusters found at each step. The point with the lowest p-value (typically the optimal cutpoint) is highlighted.

Usage

greenplot(
  g,
  type = "b",
  bg = "gray75",
  pch = 21,
  cex = 1,
  optim.col = "red",
  pos = 2,
  main = "P-Value vs. R-Squared for Num. Clusters",
  xlab = "r-squared",
  ylab = NULL,
  ...
)

Arguments

g

an object of the type produced by greenclust

type

1-character string giving the type of plot desired: "p" for points, "l" for lines, and "b" (the default) for both points and lines.

bg

a vector of background colors for open plot symbols. Also used for the line color if type is "b".

pch

a vector of plotting characters or symbols: see points

cex

a numerical vector giving the amount by which plotting characters and symbols should be scaled relative to the default. For this plot, the numeric labels on each point are always scaled to 0.80 of this value.

optim.col

color to use for highlighting the "optimal" cutpoint.

pos

specifies the position of labels relative to their points: 1 = below, 2 = left, 3 = above, and 4 = right.

main

an overall title for the plot.

xlab

a title for the x axis.

ylab

a title for the y axis.

...

additional arguments to be passed to the plotting methods.

References

Greenacre, M.J. (1988) "Clustering the Rows and Columns of a Contingency Table," Journal of Classification 5, 39-51. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1007/BF01901670")}

See Also

greenclust, greencut, assign.cluster

Examples

# Combine Titanic passenger attributes into a single category
# and create a contingency table for the non-zero levels
tab <- t(as.data.frame(apply(Titanic, 4:1, FUN=sum)))
tab <- tab[apply(tab, 1, sum) > 0, ]

grc <- greenclust(tab)
greenplot(grc)


# Plot using custom graphical parameters
greenplot(grc, type="p", bg="lightblue", optim.col="darkorange",
          pos=3, bty="n", cex.main=2, col.main="blue")

JeffJetton/greenclust documentation built on Sept. 21, 2023, 12:14 p.m.