create the base plot maps for CA type
graphs with ggplot2
.
createFactorMap.Rd
createFactorMap
:
Creates the ggplot2
basic factor maps for CA type graphs.
The final maps are created by using overlays on top of the base map.
A map for CA is created with the baseMap to which
is added text/dot map.
createFactorMap
calls the functions map4DotsAndLabels
and createBaseMap
.
Usage
createFactorMap(
X,
axis1 = 1,
axis2 = 2,
constraints = NULL,
title = NULL,
col.points = "blueviolet",
alpha.points = 0.5,
display.points = TRUE,
pch = 19,
cex = 2.5,
display.labels = TRUE,
col.labels = "darkorchid4",
alpha.labels = 1,
text.cex = 4,
font.face = "bold",
font.family = "sans",
col.axes = "darkorchid",
alpha.axes = 0.2,
width.axes = 1.1,
col.background = adjustcolor("lavender", alpha.f = 0.2),
force = 1,
segment.size = 0,
...
)
Arguments
- X
the factor scores to plot.
- axis1
the column of X used for the horizontal axis of the plot. Default = 1.
- axis2
the column of X used for the vertical axis of the plot. Default = 2.
- constraints
a list with
minx miny maxx maxy
, typically obtained fromExPosition
. IfNULL
(default) it is computed with the functionprettyGraphs::minmaxHelper()
.- title
A title for the graph. Default is
NULL
.- col.points
the color of the points/dots. Can be one color or a vector of colors. If a vector, it needs to have exactly the number of items to be plotted. Default =
'blueviolet'
.- alpha.points
(default = .5), the alpha (transparency) for the points, should be between 1 (opaque) and 0 (completely transparent).
- display.points
if
TRUE
(Default) create the map for the points.- pch
the character for the points, Default is 19 (circles).
- cex
size of the dots. Default = 2.5
- display.labels
if
TRUE
(Default), create the map for the labels.- col.labels
the color of the labels Can be one color or a vector of colors. If a vector it needs to have exactly the number of items to be plotted. Default =
'darkorchid'
.- alpha.labels
(default = 1), the alpha (transparency) for the points, should be between 1 (no transparency) and 0 (completely transparent).
- text.cex
= 4, font size for labels.
- font.face
(Default =
'bold'
) font for labels.- font.family
(Default =
'sans'
) font family for labels.- col.axes
color for the axes, default is
'darkorchid'
.- alpha.axes
alpha parameter (transparency) for the axes, default is .2.
- width.axes
the width of the axes, default is 1.1.
- col.background
the color theme of the background, default is
adjustcolor('lavender', alpha.f = .2)
.- force
(default = 1)
. How muchggrepel
repels the label- segment.size
(default = 0)
size of segment line forggrpel
.- ...
stuff to be passed to other functions.
Value
a list with 6 elements:
zeMap
: The Complete Map (background Dots and Labels);zeMap_background
: The Background;zeMap_dots:
: The dots;zeMap_text:
: The Labels;factorScores:
: The factor scores; andconstraints:
: The list of the contraints'
Important_Note
When creating multiple layers graphs,
because of the way ggplot2
create graphs, all
the matrices/dataframe should all the have the same column names
e.g., SrczlIjekHeoUY4Nm9hEz70JZlVXSUoq-2- equal to SrczlIjekHeoUY4Nm9hEz70JZlVXSUoq-3-.
When it is not the case, some strange and cryptic
error may be produced
(e.g., "cannot find Dimension"
).