View source: R/addCircleOfCor.R
addArrows | R Documentation |
addArrows
:
Add arrows to a factorial map
(i.e., a PCA-like map),
most likely a plot of correlation produced by
createFactorMap
et alia.
addArrows(
X,
axis1 = 1,
axis2 = 2,
color = "darkorchid",
alpha = 0.6,
size = 1,
center = c(0, 0),
arrowLength = 0.3,
linetype = 1
)
X |
a data frame with the coordinates of the points
(e.g., from |
axis1 |
( |
axis2 |
( |
color |
the color of the arrows. Can be one color or a vector of colors.
If |
alpha |
(Default: 0.6), the alpha (transparency) for the arrows, should be between 1 (no transparency) and 0 (completely transparent). |
size |
( |
center |
( |
arrowLength |
( |
linetype |
( |
The map should should first be created by, for example,
createFactorMap()
(or equivalent functions from
PTCA4CATA
), and then the arrows are added
(see example). addArrows
is typically used
with addCircleOfCor
.
a ggplot2
component to be added to a
scatterplot / map (typically created by
createFactorMap()
).
annotate
addCircleOfCor
createFactorMap
## Not run:
# Some PCA-like correlations
corXY <- matrix(c(.5,-.5, .1,.7, .8,.5, -.1,.9, -.6,-.6),
ncol = 2, byrow = TRUE )
# create a map of correlation
MapCor <- createFactorMap(corXY,
constraints = list(minx = -1, miny = -1,
maxx = 1 , maxy = 1) )
# Add arrows and a circle to the base Map
ggMapWithCircle <- MapCor$zeMap + addArrows(corXY) + addCircleOfCor()
# To print the map with arrows and circle:
# print(ggMapWithCircle)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.