map.add: Add points to an existing map created by one of the soc.ca...

Description Usage Arguments Examples

View source: R/functions_plot.r

Description

Add points to an existing map created by one of the soc.ca mapping functions.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
map.add(
  object,
  ca.map,
  plot.type = NULL,
  ctr.dim = 1,
  list.mod = NULL,
  list.sup = NULL,
  list.ind = NULL,
  point.shape = "variable",
  point.alpha = 0.8,
  point.fill = "whitesmoke",
  point.color = "black",
  point.size = "freq",
  label = TRUE,
  label.repel = TRUE,
  label.alpha = 0.8,
  label.color = "black",
  label.size = 4,
  label.fill = NULL,
  labelx = "default",
  labely = "default",
  legend = NULL
)

Arguments

object

a soc.ca class object as created by soc.mca and soc.csa

ca.map

a map created using one of the soc.ca map functions

plot.type

defines which type of points to add to the map. Accepted values are: "mod", "sup", "ind", "ctr". These values correspond to the different forms of

ctr.dim

the dimensions of the contribution values

list.mod

a numerical vector indicating which active modalities to plot. It may also be a logical vector of the same length and order as the modalities in object$names.mod.

list.sup

a numerical vector indicating which supplementary modalities to plot. It may also be a logical vector of the same length and order as the modalities in object$names.sup.

list.ind

a numerical vector indicating which individuals to plot. It may also be a logical vector of the same length and order as the modalities in object$names.ind.

point.shape

a numerical value defining the shape of the points. If set to its default, the default scale is used. It may be mapped to a variable with a suitable length and order.

point.alpha

defines the alpha of the points. Values range from 0 to 1. It may be mapped to a variable with a suitable length and order.

point.fill

defines the fill color of the points. It may be mapped to a variable with a suitable length and order.

point.color

defines the color of the points. It may be mapped to a variable with a suitable length and order. See colors for some of the valid values.

point.size

a numerical value defining the size of the points. If set to its default, the size is determined by the frequency of each modality. It may be defined by a variable with a suitable length.

label

if TRUE each point is assigned its label, defined in the soc.ca object. See assign.label and add.to.label for ways to alter the labels.

label.repel

if TRUE overlapping labels are rearranged, see geom_text_repel or geom_label_repel.

label.alpha

defines the alpha of the labels. Values range from 0 to 1. It may be mapped to a variable with a suitable length and order.

label.color

defines the color of the labels. It may be mapped to a variable with a suitable length and order. See colors for some of the valid values.

label.size

defines the size of the labels. It may be mapped to a variable with a suitable length and order.

label.fill

defines the color of the box behind the labels. It may be mapped to a variable with a suitable length and order. This only works if label.repel is TRUE. See geom_label_repel.

labelx

the label of the horizontal axis. If set to NULL a standard label is used.

labely

the label of the vertical axis. If set to NULL a standard label is used.

legend

if set to TRUE a legend is provided. Change the legend with the guides, theme and linkguide_legend functions from the ggplot2 package.

dim

the dimensions in the order they are to be plotted. The first number defines the horizontal axis and the second number defines the vertical axis.

Examples

1
2
3
4
5
example(soc.ca)
original.map    <- map.sup(result)
map.add(result, original.map, plot.type = "ctr", ctr.dim = 2)
map.add(result, map.ind(result), plot.type = "select",list.ind = 1:50,
 point.color = "red", label = FALSE, point.size = result$ctr.ind[1:50, 1]*2000)

Example output

Loading required package: ggplot2

soc.ca> data(taste)

soc.ca> # Create a data frame of factors containing all the active variables 
soc.ca> taste          <- taste[which(taste$Isup == 'Active'), ]

soc.ca> attach(taste)

soc.ca> active         <- data.frame(TV, Film, Art, Eat)

soc.ca> sup            <- data.frame(Gender, Age, Income)

soc.ca> detach(taste)

soc.ca> # Runs the analysis
soc.ca> result         <- soc.mca(active, sup)
Scale for 'shape' is already present. Adding another scale for 'shape', which
will replace the existing scale.
Scale for 'x' is already present. Adding another scale for 'x', which will
replace the existing scale.
Scale for 'y' is already present. Adding another scale for 'y', which will
replace the existing scale.
Scale for 'shape' is already present. Adding another scale for 'shape', which
will replace the existing scale.
Scale for 'x' is already present. Adding another scale for 'x', which will
replace the existing scale.
Scale for 'y' is already present. Adding another scale for 'y', which will
replace the existing scale.

soc.ca documentation built on Sept. 5, 2021, 5:21 p.m.

Related to map.add in soc.ca...