Skip to content

Commit

Permalink
list dropped aesthetics + write draw key example
Browse files Browse the repository at this point in the history
  • Loading branch information
corybrunson committed Feb 5, 2024
1 parent 4ebc286 commit 4062966
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 6 deletions.
3 changes: 3 additions & 0 deletions R/draw-key-simplex.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
#' @name draw_key
#' @import ggplot2
#' @inheritParams ggplot2::draw_key
#' @example inst/examples/ex-draw-key-simplex.R

# file.edit("inst/examples/ex-draw-key-simplex.R")

draw_key_simplex <- function(data, params, size) {

Expand Down
7 changes: 3 additions & 4 deletions R/landscape.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@

#' @eval rd_sec_aesthetics(
#' stat_landscape = StatLandscape,
#' geom_landscape = GeomLandscape,
#' extra_note = paste0(
#' "`start` and `end` are dropped during the statistical transformation."
#' )
#' geom_landscape = GeomLandscape
#' )

#' @eval rd_sec_computed_vars(
Expand Down Expand Up @@ -66,6 +63,8 @@ StatLandscape <- ggproto(

# default_aes = aes(group = interaction(after_stat(level), group)),

dropped_aes = c("start", "end"),

setup_data = StatPersistence$setup_data,

setup_params = StatPersistence$setup_params,
Expand Down
2 changes: 2 additions & 0 deletions R/persistence.R
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ StatPersistence <- ggproto(

# optional_aes = c("dataset"),

dropped_aes = c("start", "end"),

# only explicitly passed params
setup_params = function(data, params) {

Expand Down
24 changes: 24 additions & 0 deletions inst/examples/ex-draw-key-simplex.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@

# regular pentagon
fifths <- (seq_len(5) - 1) * 2 * pi / 5
pentagon <- data.frame(x = cos(fifths), y = sin(fifths))
ggplot(pentagon, aes(x, y)) +
geom_simplicial_complex(
diameter = 2, dimension_max = 5L, one_simplices = "all",
engine = "simplextree",
aes(color = after_stat(factor(dimension)),
fill = after_stat(factor(dimension))),
alpha = .5
)

# regular septagon
sevenths <- (seq_len(7) - 1) * 2 * pi / 7
septagon <- data.frame(x = cos(sevenths), y = sin(sevenths))
ggplot(septagon, aes(x, y)) +
geom_simplicial_complex(
diameter = 1.6, dimension_max = 5L, one_simplices = "all",
engine = "simplextree",
aes(color = after_stat(factor(dimension)),
fill = after_stat(factor(dimension))),
alpha = .5
)
26 changes: 26 additions & 0 deletions man/draw_key.Rd

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

2 changes: 0 additions & 2 deletions man/landscape.Rd

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

0 comments on commit 4062966

Please sign in to comment.