View source: R/theme_palette.R
| theme_factoextra | R Documentation |
A ggplot2 theme tuned for the dimension-reduction scatter plots and biplots
produced by the fviz_*() functions: a light, unobtrusive coordinate grid
(so points can be read against the axes), a clean background, and de-emphasized
axis lines. Pass it through the ggtheme argument, e.g.
fviz_pca_ind(res, ggtheme = theme_factoextra()), or add it to any
returned plot with + theme_factoextra().
Read more: ggplot2 Themes in R: Customize the Look.
theme_factoextra(base_size = 12, base_family = "")
base_size |
base font size, in points. |
base_family |
base font family. |
The fviz_* functions have different default themes
(fviz_pca_* use theme_minimal(), fviz_cluster() uses
theme_grey(), fviz_dend() uses theme_classic(), ...).
For one consistent look across several plots in the same document, pass
ggtheme = theme_factoextra() to each call (see the last example) rather
than relying on ggplot2::theme_set(), which the fviz_* functions
override with their explicit ggtheme default.
A ggplot2 theme object.
factoextra_palette.
Online tutorial: ggplot2 Themes in R: Customize the Look.
data(iris)
res.pca <- prcomp(iris[, 1:4], scale. = TRUE)
fviz_pca_ind(res.pca, habillage = iris$Species,
palette = factoextra_palette("okabe"),
ggtheme = theme_factoextra())
# or add it to an existing plot
fviz_pca_var(res.pca) + theme_factoextra()
# a consistent look across the family: pass the same ggtheme to each call
km <- kmeans(scale(iris[, 1:4]), 3)
fviz_pca_ind(res.pca, ggtheme = theme_factoextra())
fviz_cluster(km, data = iris[, 1:4], ggtheme = theme_factoextra())
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.