plot.LexGalt {Xplortext} | R Documentation |
Plot LexGalt objects
Description
Plots Generalised Aggregate Lexical Tables (LexGalt) graphs from a LexGalt object
Usage
## S3 method for class 'LexGalt'
plot(x,type="QL", selDoc=NULL, selWord=NULL, selQualiVar=NULL,
selQuantiVar=NULL, conf.ellip=FALSE, selWordEllip=NULL, selQualiVarEllip=NULL,
selQuantiVarEllip=NULL, level.conf=0.95, eigen=FALSE, title = NULL, axes = c(1, 2),
xlim = NULL, ylim = NULL, col.eig="grey", col.doc = "black", col.word = NULL,
col.quali = "blue", col.quanti = "blue", col="grey", pch = 20, label = TRUE,
autoLab = c("auto", "yes", "no"), palette = NULL, unselect = 1,
selCov=FALSE, selGroup="ALL", partial=FALSE, plot.group=FALSE,
col.group=NULL, label.group=NULL, legend=TRUE, pos.legend="topleft",
new.plot = TRUE, cex=1,...)
Arguments
x |
object of LexGalt class |
type |
results from a qualitative analysis (type="QL") or quantitative analysis (type="QN"); see details; by default Q) |
selDoc |
vector with the documents to plot (indexes, names or rules; see details; by default NULL) |
selWord |
vector with the words to plot (indexes, names or rules (indexes, names or rules; see details; by default NULL) |
selQualiVar |
vector with the categories of categorical variables to plot (indexes, names or rules; see details; by default NULL) |
selQuantiVar |
vector with the numerical variables to plot (indexes, names or rules; see details; by default NULL) |
conf.ellip |
to drawn confidence ellipses, by default FALSE |
selWordEllip |
vector with the words that defines which ellipses are drawn (indexes, names or rules; see details; by default NULL) |
selQualiVarEllip |
vector with the categories of categorical variables which ellipses are drawn (indexes, names or rules; see details; by default NULL) |
selQuantiVarEllip |
vector with the numerical variables which ellipses are drawn(indexes, names or rules; see details; by default NULL) |
level.conf |
level of confidence used to construct the ellipses; by default 0.95 |
eigen |
if TRUE, the eigenvalues barplot is drawn (by default FALSE); other elements can be simultaneously selected |
title |
title of the graph (by default NULL and the title is automatically assigned) |
axes |
length-2 vector indicating the axes considered in the graph; by default c(1,2) |
xlim |
range for 'x' values on the graph, defaulting to the finite values of 'x' range (by default NULL) |
ylim |
range for the 'y' values on the graph, defaulting to the the finite values of 'y' range (by default NULL) |
col.eig |
value or vector with colors for the bars of eigenvalues (by default "grey") |
col.doc |
color for the point-documents(by default "black") |
col.word |
color for the point-words (by default NULL is darkred in simple analysis; see details) |
col.quali |
color for the categories of categorical variables (by default "blue") |
col.quanti |
color for the numerical variables (by default "blue") |
col |
color for the bars in the eigenvalues barplot (by default "grey") |
pch |
plotting character for coordinates, cf. |
label |
a list of character for the elements which are labelled (by default TRUE and all the drawn elements are labelled). |
autoLab |
if autoLab="auto", autoLab turns to be equal to "yes" if there are less than 50 elements and equal to "no" otherwise; if "yes", the labels are moved, as little as possible, to avoid overlapping (time-consuming if many elements); if "no" the labels are placed quickly but may overlap |
palette |
the color palette used to draw the points. By default colors are chosen. If you want to define the colors : palette=c("black", "red", "blue"); or you can use: palette=rainbow(10), or in black and white for example: palette=gray(seq(0,.9,len=3)) |
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") |
selCov |
a boolean, if TRUE then data are scaled to unit variance (by default TRUE) |
selGroup |
vector with the groups to plot if multiple analysis was performed (indexes, names or rules; see details; by default NULL) |
partial |
if TRUE partial elements (results for the groups) are shown, if ALL results for the conjoint analysis are superimposed; by default FALSE |
plot.group |
draw a plot comparing the groups in multiple case (by default TRUE) |
col.group |
color for the groups if multiple analysis was performed (by default NULL and they are selected from palette) |
label.group |
a vector containing the new name of the groups. If "BLANK" no labels with the group are added at the end of the drawn elements (by default, NULL and the name of each group is added) |
legend |
show the legend of labels of groups. See |
pos.legend |
position of the legend of labels of groups. See |
new.plot |
if TRUE, a new graphical device is created (by default TRUE) |
cex |
text and symbol size is scaled by cex, in relation to size 1 (by default 1) |
... |
further arguments passed from other methods... |
Details
The argument autoLab = "yes" is time-consuming if many overlapping labels. Furthermore, the visualization of the words cloud can result distorted because of the apparent greater dispersion of the words labels. An alternative would be reducing the character size of the words labels to reduce overlapping (e.g. cex=0.7).
selDoc, selWord, selQualiVar, selQuantiVar, selWordEllip, selQualiVarEllip,
selQuantiVarEllip allow for selecting all or part of the elements of the corresponding type, using either labels, indexes or rules.
The syntax is the same for all types.
1. Using labels:
selDoc = c("doc1","doc5"): only the documents with labels doc1 and doc5 are plotted. selQualiVar=c("category1","category2"): only the categories labeled category1 and category2 are plotted.
2.- Using indexes:
selDoc = c(1:5): documents 1 to 5 are plotted. quali.sup=c(1:5,7): categories 1 to 5 and 7 are plotted. The numbering of the categories have to be consulted in the LexGalt numerical results.
3.- Using rules:
Rules are based on the coordinates (coord), the contribution (contrib or meta) or the square cosine (cos2).
Somes examples are given hereafter:
selDoc="coord 10": only the 10 documents with the highest coordinates, as globally computed on the 2 axes, are plotted. selWord="contrib 10": the words with a contribution to the inertia, of any of the 2 axes. selWord="meta 3": the words with a contribution over 3 times the average word contribution on any of the two axes are plotted. selWord="cos2 .85": the words with a cos2 over 0.85, as summed on the 2 axes, are plotted.
col.word by default NULL is "darkred" for simple analysis, if it is null takes the colors from col.group i.e. col.group=c("red","blue"). To select the colors for some words in object res, we can use: str.col.words <- rep("darkred",nrow(res$MQL$word$coord)) str.col.words[which(rownames(res$MQL$word$coord) == "kids")] <- "red" str.col.words[which(rownames(res$MQL$word$coord) == "friends")] <- "green" str.col.words[which(rownames(res$MQL$word$coord) == "job")] <- "pink" plot(res, selGroup=1, selWord=c("friends", "job", "kids", "at"),new.plot=FALSE, col.group=c("darkred","blue"), autoLab = "yes", col.word=str.col.words)
Author(s)
Belchin Kostov, Monica Bécue-Bertaut, Ramón Alvarez-Esteban ramon.alvarez@unileon.es, Josep-Antón Sánchez-Espigares
References
Bécue-Bertaut M. and Pagès J. (2015). Correspondence analysis of textual data involving contextual information: CA-GALT on principal components. Advances in Data Analysis and Classification, vol.(9) 2: 125-142.
Bécue-Bertaut M., Pagès J. and Kostov B. (2014). Untangling the influence of several contextual variables on the respondents' lexical choices. A statistical approach. SORT - Statistics and Operations Research Transactions, vol.(38) 2: 285-302.
Kostov B. A. (2015). A principal component method to analyse disconnected frequency tables by means of contextual information. (Doctoral dissertation). Retrieved from http://upcommons.upc.edu/handle/2117/95759.
See Also
Examples
## Not run:
data(open.question)
res.TD<-TextData(open.question,var.text=c(9,10), Fmin=10, Dmin=10,
context.quali=c("Gender", "Age_Group", "Education"),
remov.number=TRUE, stop.word.tm=TRUE)
res.LexGalt <- LexGalt(res.TD, graph=FALSE, nb.ellip =0)
plot(res.LexGalt, selQualiVar="ALL")
## End(Not run)