plot.CA: Draw the Correspondence Analysis (CA) graphs

plot.CAR Documentation

Draw the Correspondence Analysis (CA) graphs

Description

Draw the Correspondence Analysis (CA) graphs.

Usage

## S3 method for class 'CA'
plot(x, axes = c(1, 2),
    xlim = NULL, ylim = NULL, 
	invisible = c("none","row","col","row.sup","col.sup","quali.sup"), 
	choix = c("CA","quanti.sup"), col.row="blue", col.col="red", 
	col.row.sup="darkblue", col.col.sup="darkred", 
    col.quali.sup="magenta", col.quanti.sup="blue",
	label = c("all","none","row","row.sup","col","col.sup","quali.sup","quanti.sup"), 
    title = NULL, palette = NULL, autoLab = c("auto","yes","no"), 
	new.plot=FALSE, selectRow = NULL, selectCol = NULL,
	unselect = 0.7, shadowtext = FALSE, habillage = "none",
	legend = list(bty = "y", x = "topleft"), 
	graph.type = c("ggplot","classic"), ggoptions = NULL, ...)

Arguments

x

an object of class CA

axes

a length 2 vector specifying the components to plot

xlim

range for the plotted 'x' values, defaulting to the range of the finite values of 'x'

ylim

range for the plotted 'y' values, defaulting to the range of the finite values of 'y'

invisible

string indicating if some points should be unlabelled ("row", "col", "row.sup", "col.sup","quali.sup")

choix

the graph to plot ("CA" for the CA map, "quanti.sup" for the supplementary quantitative variables)

col.row

a color for the rows points

col.col

a color for columns points

col.row.sup

a color for the supplementary rows points

col.col.sup

a color for supplementary columns points

col.quali.sup

a color for the supplementary categorical variables

col.quanti.sup

a color for the supplementary quantitative variables

label

a list of character for the elements which are labelled (by default, all the elements are labelled ("row", "row.sup", "col", "col.sup","quali.sup","quanti.sup")

title

string corresponding to the title of the graph you draw (by default NULL and a title is chosen)

palette

the color palette used to draw the points. By default colors are chosen. If you want to define the colors : palette=palette(c("black","red","blue")); or you can use: palette=palette(rainbow(30)), or in black and white for example: palette=palette(gray(seq(0,.9,len=25)))

autoLab

if autoLab="auto", autoLab is equal to "yes" if there are less than 50 elements and "no" otherwise; if "yes", the labels of the drawn elements are placed in a "good" way (can be time-consuming if many elements), and if "no" the elements are placed quickly but may overlap

new.plot

boolean, if TRUE, a new graphical device is created

selectRow

a selection of the rows that are drawn; see the details section

selectCol

a selection of the columns that are drawn; see the details section

unselect

may be either a value between 0 and 1 that gives the transparency of the unselected objects (if unselect=1 the transparceny is total and the elements are not drawn, if unselect=0 the elements are drawn as usual but without any label) or may be a color (for example unselect="grey60")

shadowtext

boolean; if true put a shadow on the labels (rectangles are written under the labels which may lead to difficulties to modify the graph with another program)

habillage

color the individuals among a categorical variable (give the number of the categorical supplementary variable or its name)

legend

a list of arguments that defines the legend if needed (when individuals are drawn according to a variable); see the arguments of the function legend

graph.type

a character that gives the type of graph used: "ggplot" or "classic"

ggoptions

a list that gives the graph options when grah.type="ggplot" is used. See the optines and the default values in the details section

...

further arguments passed to or from other methods, such as cex, cex.main, ...

Details

The argument autoLab = "yes" is time-consuming if there are many labels that overlap. In this case, you can modify the size of the characters in order to have less overlapping, using for example cex=0.7.
The selectRow and selectCol arguments can be used in order to select a part of the elements that are drawn. For example, you can use:
selectRow = 1:5 and then the rows 1 to 5 are drawn.
select = c("name1","name5") and then the rows that have the names name1 and name5 are drawn.
select = "coord 10" and then the 10 rows (10 active and 10 supplementaries) that have the highest (squared) coordinates on the 2 chosen dimensions are drawn.
select = "contrib 10" and then the 10 rows (10 active) that have the highest contribution on the 2 dimensions of your plot are drawn.
select = "cos2 5" and then the 5 rows (5 actives and 5 supplementaries) that have the highest cos2 on the 2 dimensions of your plot are drawn.
select = "dist 8" and then the 8 rows (8 actives and 8 supplementaries) that have the highest distance to the center of gravity are drawn.

Value

Returns the factor map with the joint plot of CA.

Author(s)

Francois Husson francois.husson@institut-agro.fr

See Also

CA

Examples

data(children)
res.ca <- CA (children, col.sup = 6:8, row.sup = 15:18)

## select rows and columns that have a cos2 greater than 0.8
plot(res.ca, selectCol="cos2 0.8", selectRow="cos2 0.8")

## Not run: 
## You can modify the ggplot graphs as ususal with ggplot2
require(ggplot2)
gr <- plot(res.ca)
gr + theme(panel.grid.major = element_blank(),
   plot.title=element_text(size=14, color="blue"),
   axis.title = element_text(size=12, color="red"))

## End(Not run)

FactoMineR documentation built on May 29, 2024, 3:36 a.m.