View source: R/functions_build_plot.r
add.quadrant.labels | R Documentation |
This function is a convience function that uses annotate to easily create labels for the quadrants.
add.quadrant.labels(
quadrant.labels = c("A", "B", "C", "D"),
distance = "npc",
geom = "label",
color = "black",
...
)
quadrant.labels |
|
distance |
if equal to "npc" labels are positioned dynamically at the edges of the plot. see annotate. If a numeric vector it is interpreted as the distance to 0 on both X and Y. |
geom |
controls the annotation geom; usually you would use "text" or "label". |
color |
either a single value or 4 values that control the color of the labels |
... |
further arguments are passed onto annotate |
a ggplot2 layer that can be added to an existing ggplot object.
example(soc.mca)
map.ind(result, point.size = 1) + add.quadrant.labels()
labels <- c("Dominant:\nCultural fraction", "Dominant:\nEconomic fraction", "Dominated:\nEconomic fraction", "Dominated:\nCultural fraction")
map.ca.base() + add.quadrant.labels(labels, geom = "text")
map.ca.base() + add.ind(result, color = "grey80") + add.quadrant.labels(labels, geom = "text", distance = 1)
map.ca.base() + add.categories(result, color = "grey50", check_overlap = TRUE) + add.quadrant.labels(labels, geom = "label", distance = 0.5, fill = c("#E41A1C", "#377EB8", "#4DAF4A", "#984EA3"), alpha = 0.3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.