Skip to content

Commit

Permalink
Merge pull request #152 from animint/fix148
Browse files Browse the repository at this point in the history
@export internal S3 methods
  • Loading branch information
tdhock authored Sep 17, 2024
2 parents 994006d + faf8135 commit 70bb33b
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: animint2
Title: Animated Interactive Grammar of Graphics
Version: 2024.8.29
Version: 2024.9.17
URL: https://animint.github.io/animint2/
BugReports: https://github.com/animint/animint2/issues
Authors@R: c(
Expand Down
6 changes: 6 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ S3method(facet_vars,grid)
S3method(facet_vars,null)
S3method(facet_vars,wrap)
S3method(finite.cases,data.frame)
S3method(flag_axis,grid)
S3method(flag_axis,null)
S3method(flag_axis,wrap)
S3method(format,facet)
S3method(format,gganimintproto)
S3method(format,gganimintproto_method)
Expand All @@ -48,6 +51,9 @@ S3method(fortify,data.frame)
S3method(fortify,default)
S3method(fortify,lm)
S3method(fortify,map)
S3method(getStrips,grid)
S3method(getStrips,null)
S3method(getStrips,wrap)
S3method(ggplot,data.frame)
S3method(ggplot,default)
S3method(grid.draw,absoluteGrob)
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Changes in version 2024.9.17

- @export for internal S3 methods, to quiet roxygen2::document() messages.

# Changes in version 2024.8.29 (PR#147)

- animint2pages initial commit README.md uses viz title.
Expand Down
6 changes: 6 additions & 0 deletions R/z_facets.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ getStrips <- function(facet, panel, ...)
# themes or special options later
UseMethod("getStrips")

#' @export
getStrips.grid <- function(facet, panel, ...) {
npanels <- nrow(panel$layout)
# preallocate strip labels to a default of ""
Expand Down Expand Up @@ -39,6 +40,7 @@ build_strip <- function(panel, label_df, labeller, side = "right", ...) {
apply(labels, 1, paste, collapse = "; ")
}

#' @export
getStrips.wrap <- function(facet, panel, ...) {
labels_df <- panel$layout[names(facet$facets)]
labels_df[] <- plyr::llply(labels_df, format, justify = "none")
Expand All @@ -50,6 +52,7 @@ getStrips.wrap <- function(facet, panel, ...) {
strips
}

#' @export
getStrips.null <- function(facet, panel, ...) {
list(top = list(""), right = list(""), n = list(top = 0, right = 0))
}
Expand All @@ -61,6 +64,7 @@ getStrips.null <- function(facet, panel, ...) {
flag_axis <- function(facet, layout)
UseMethod("flag_axis")

#' @export
flag_axis.grid <- function(facet, layout) {
# 'grid rules' are to draw y-axis on panels with COL == 1
# and ROW == max(ROW).
Expand All @@ -69,12 +73,14 @@ flag_axis.grid <- function(facet, layout) {
layout
}

#' @export
flag_axis.wrap <- function(facet, layout) {
if (sum(grepl("^AXIS_[X-Y]$", names(layout))) != 2)
stop("Expected 'AXIS_X' and 'AXIS_Y' to be in panel layout")
layout
}

#' @export
flag_axis.null <- function(facet, layout) {
cbind(layout, AXIS_X = TRUE, AXIS_Y = TRUE)
}
Expand Down

0 comments on commit 70bb33b

Please sign in to comment.