ggca | R Documentation |
A readable, complete and beautiful graph for simple
correspondence analysis made with FactoMineR::CA
.
Interactive tooltips, appearing when hovering on points with mouse, allow to
keep in mind all the content of the table while reading the graph. Since it is
made in the spirit of ggplot2
, it is possible to change
theme or add another plot elements with +. Then, interactive
tooltips won't appear until you pass the result through ggi
.
ggca(
res.ca = res.ca,
axes = c(1, 2),
show_sup = FALSE,
xlim,
ylim,
out_lims_move = FALSE,
type = c("points", "text", "labels"),
text_repel = FALSE,
uppercase = "col",
tooltips = c("row", "col"),
rowtips_subtitle = "Row pct",
coltips_subtitle = "Column pct",
rowcolor_numbers = 0,
colcolor_numbers = 0,
cleannames = TRUE,
filter = "",
title,
text_size = 3.5,
dist_labels = c("auto", 0.12),
right_margin = 0,
size_scale_max = 8,
use_theme = TRUE
)
res.ca |
An object created with |
axes |
The axes to print, as a numeric vector of length 2. |
show_sup |
When |
xlim , ylim |
Horizontal and vertical axes limits, as double vectors of length 2. |
out_lims_move |
When |
type |
Determines the way the two variables of the table are printed.
|
text_repel |
When |
uppercase |
Print |
tooltips |
Choose the content of interactive tooltips at mouse hover :
|
rowtips_subtitle , coltips_subtitle |
The subtitles used before the table in interactive tooltips. |
rowcolor_numbers , colcolor_numbers |
If row var or col var levels are
prefixed with numbers(ex. : |
cleannames |
Set to |
filter |
Regex patterns to discard levels of row or col variables. |
title |
The title of the graph. |
text_size |
Size of text. |
dist_labels |
When |
right_margin |
A margin at the right, in cm. Useful to read tooltips over points placed at the right of the graph without formatting problems. |
size_scale_max |
Size of points. |
use_theme |
By default, a specific |
A ggplot
object to be printed in the
'RStudio' Plots pane. Possibility to add other gg objects with +
.
Sending the result through ggi
will draw the
interactive graph in the Viewer pane using ggiraph
.
# Make the correspondence analysis :
tabs <- table(forcats::gss_cat$race, forcats::gss_cat$marital)[-4,]
# tabs <- tabxplor::tab_plain(forcats::gss_cat, race, marital, df = TRUE)
res.ca <- FactoMineR::CA(tabs, graph = FALSE)
# Interactive plot :
graph.ca <- ggca(res.ca,
title = "Race by marital : correspondence analysis",
tooltips = c("row", "col"))
ggi(graph.ca) #to make the plot interactive
# Image plot :
ggca(res.ca,
title = "Race by marical : correspondence analysis",
text_repel = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.