Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@export internal S3 methods #152

Merged
merged 1 commit into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading