Create ggplot2 factorial maps for CA-type of maps dots and labels.
createFactorMapIJ.Rd
createFactorMapIJ
: Creates
ggplot2
factorial maps for dots and labels.
NB needs a base map to work correctly.
Usage
createFactorMapIJ(
Fi,
Fj,
axis1 = 1,
axis2 = 2,
constraints = NULL,
title = NULL,
col.points.i = "blueviolet",
alpha.points.i = 0.5,
pch.i = 19,
cex.i = 2.5,
segment.size.i = 0,
col.labels.i = "darkorchid4",
alpha.labels.i = 1,
text.cex.i = 4,
font.face.i = "bold",
font.family.i = "sans",
force.i = 1,
col.points.j = "darkolivegreen4",
alpha.points.j = 0.5,
pch.j = 18,
cex.j = 2.5,
segment.size.j = 0,
col.labels.j = "darkolivegreen",
alpha.labels.j = 0.5,
text.cex.j = 4,
font.face.j = "bold",
font.family.j = "sans",
force.j = 1,
col.axes = "darkorchid",
alpha.axes = 0.2,
width.axes = 1.1,
col.background = adjustcolor("lavender", alpha.f = 0.2),
nudge_x = 0,
nudge_y = 0,
...
)
Arguments
- Fi
the \(I\)-set factor scores to plot
- Fj
the \(J\)-set 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 from
prettyGraphs::minmaxHelper()
. IfNULL
(default) it is computed with the functionprettyGraphs::minmaxHelper()
.- title
a title for the plots.
- col.points.i
the color of the points/dots for the \(I\)-set. 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.i
(default = .5), the alpha (transparency) for the points, should be between 1 (no transparency) and 0 (completely transparent).
- pch.i
the character for the points for the \(I\)-set. Default is 19 (Circles).
- cex.i
size of the dots for the \(I\)-set. Default = 2.5
- segment.size.i
= 0, # size of segment
- col.labels.i
the color of the labels for the \(I\)-set. 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.i
(default = 1), the alpha (transparency) for the \(I\)-labels, should be between 1 (no transparency) and 0 (completely transparent).
- text.cex.i
= 4, font size for labels for the I-set.
- font.face.i
(Default =
'bold'
, font for labels for the \(I\)-set.- font.family.i
(Default =
'sans'
) font family for the \(I\)-set.- force.i
(Default = 1). How much ggrepel repels the labels for the \(I\)-set.
- col.points.j
the color of the points/dots for the \(J\)-set. 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 =
'darkolivegreen4'
.- alpha.points.j
(default = .5), the alpha (transparency) for the points, should be between 1 (no transparency) and 0 (completely transparent).
- pch.j
the character for the points for the
J
-set. Default is 18 (Diamonds).- cex.j
size of the dots for the \(J\)-set. Default = 2.5
- segment.size.j
= 0, # size of segment for \(J\)-set
- col.labels.j
the color of the labels for the \(J\)-set. 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 =
'darkolivegreen'
.- alpha.labels.j
(default = 1), the alpha (transparency) for the \(J\)-labels, should be between 1 (no transparency) and 0 (completely transparent).
- text.cex.j
(Default = 4), font size for labels for the J-set.
- font.face.j
(Default =
'bold'
), font for labels for the \(J\)-set.- font.family.j
(Default =
'sans'
) font family for the \(J\)-set.- force.j
= 1. How much ggrepel repels the labels for the \(J\)-set.
- col.axes
(Default =
'darkorchid'
) color for the axes- alpha.axes
(Default = .2) transoarency factors for the color of the axes.
- width.axes
(Default = 1.1) the width of the axes
- col.background
Default = EmR1DIXvCW5OYYXM6vba6wp8n0eq53Hu-1- The color of the background.
- nudge_x
= 0. From
ggrepel
, nudge value for starting point for labels: x dimension.- nudge_y
= 0. From
ggrepel
, nudge value for starting point for labels: y dimension.- ...
everything else for the functions
Value
a list with
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
creates graphs, all the
the matrices/dataframe should all the have the same column names
e.g., colnames()
equal to c("Dimension 1", "Dimension 2").
When it is not the case, some strange and cryptic
error may be produced
(e.g., "cannot find Dimension").