View source: R/getBiplot4PCA.R
addArrowsAndNames | R Documentation |
createFactorMap
and friends.addArrowsAndNames
:
Add arrows and names
to a factorial graph created by
createFactorMap
and friends. Use, for example, to create
a biplot by adding variables
to the observation map
addArrowsAndNames(
DATA,
axis1 = 1,
axis2 = 2,
fontface = "bold.italic",
color = "darkolivegreen"
)
DATA |
a matrix or data frame with coordinates of the items to be plotted (NB needs to have row names). |
axis1 |
horizontal axis ( |
axis2 |
vertical axis ( |
fontface |
font face for the names
( |
color |
an element or
a vector of color ( |
To be used as an add-on for map
created by createFactorMap
.
Note that for strange reasons (i.e., ggplot2
internals ....),
the returned list cannot be provided with a class
(and so the print
function cannot give a help)
A list with two elements
arrows
(ggplot
code to add the arrows)
labels4Biplot
(ggplot
code to add the names of the
items): Uses ggplot2::annotate()
.
Hervé Abdi
getBiplotCoor
## Not run:
data("twentyWines") # get the wine data set
resPCA <- ExPosition::epPCA(twentyWines$df.active,
scale = FALSE, graphs = FALSE)
getCoordinates <- getBiplotCoor(resPCA) # get biplot coordinates
aMap <- PTCA4CATA::createFactorMap(resPCA$ExPosition.Data$fi,
constraints = getCoordinates$constraints4Biplot) # create base map
add2Map <- addArrowsAndNames(getCoordinates$coordArrow) # get the arrows
print(aMap$zeMap + add2Map) # print the biplot map
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.