Skip to content

Commit

Permalink
tweak examples that pass elements param to biplot layers
Browse files Browse the repository at this point in the history
  • Loading branch information
corybrunson committed Dec 31, 2024
1 parent 7f7ae74 commit 9239cb7
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 16 deletions.
4 changes: 4 additions & 0 deletions inst/examples/ex-dplyr-verbs-iris-lda.r
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ transmute_cols(iris_lda, vec.length = sqrt(LD1^2 + LD2^2))
# bind data frames of annotations
iris_medians <-
stats::aggregate(iris[, 1:4], median, by = iris[, 5, drop = FALSE])
# TODO: Requirement of `.elements` for matching is fragile.
iris_lda %>%
# retain '.element' in order to match by `elements`
select_rows(.element) %>%
cbind_rows(iris_medians, elements = "active")
iris_lda %>%
select_rows(name, Species) %>%
left_join_rows(iris_medians, by = c("name" = "Species"))
14 changes: 7 additions & 7 deletions inst/examples/ex-methods-cancor-savings.r
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,20 @@ get_cols(savings_cca, elements = "structure")
savings_cca %>%
confer_inertia("cols") %>%
ggbiplot(aes(label = name, color = .matrix)) +
theme_bw() + theme_biplot() +
theme_bw() + theme_scaffold() +
geom_unit_circle() +
geom_rows_point(elements = "score", color = "grey") +
geom_rows_vector(arrow = NULL, elements = "structure") +
geom_cols_vector(arrow = NULL, elements = "structure", linetype = "dashed") +
geom_rows_text(elements = "structure", hjust = "outward") +
geom_cols_text(elements = "structure", hjust = "outward") +
scale_color_brewer(limits = c("rows", "cols"), type = "qual") +
expand_limits(x = c(-1, 1), y = c(-1, 1))

# biplot with scores as supplemental elements
# situate country scores along financial variables
savings_cca %>%
confer_inertia("rows") %>%
ggbiplot(aes(label = name), sec.axes = "cols", scale.factor = 5L) +
theme_biplot() +
geom_cols_vector(elements = "active") +
geom_cols_text_radiate(elements = "active") +
geom_rows_text(elements = "score", subset = seq(50L))
ggbiplot(aes(label = name)) +
theme_scaffold() +
geom_cols_axis(elements = "active") +
geom_rows_text(elements = "score")
2 changes: 1 addition & 1 deletion inst/examples/ex-stat-matrix-swiss.r
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ head(get_rows(swiss_fa, elements = "score"))
# (note that filter precedes selection)
ggbiplot(swiss_fa) +
geom_rows_point(elements = "score") +
geom_rows_text(aes(label = name), elements = "score", subset = c(1, 4, 18)) +
geom_rows_label(aes(label = name), elements = "score", subset = c(1, 4, 18)) +
scale_alpha_manual(values = c(0, 1), guide = "none") +
geom_cols_vector() +
geom_cols_text_radiate(aes(label = name))
4 changes: 4 additions & 0 deletions man/dplyr-verbs.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions man/methods-cancor.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/stat_rows.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 9239cb7

Please sign in to comment.