Skip to content

Commit

Permalink
Merge branch 'master' into rc-v2.2.1
Browse files Browse the repository at this point in the history
* master:
  Safeguard suggested `{intergraph}` package in tests (#491)
  Use `{testthat}` edition 3 (#490)
  Work around `scale_y_continuous()` behavior in {ggplot2@3.5} (#488)
  Update test snapshots using `{ggplot2@3.5}` (#489)
  • Loading branch information
schloerke committed Feb 12, 2024
2 parents d80ad82 + 85a4944 commit ba17416
Show file tree
Hide file tree
Showing 135 changed files with 67,478 additions and 65,005 deletions.
5 changes: 4 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,11 @@ Suggests:
emmeans,
vdiffr
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.3
RoxygenNote: 7.3.1
SystemRequirements: openssl
Encoding: UTF-8
Language: en-US
RdMacros: lifecycle
Remotes:
tidyverse/ggplot2@rc/3.5.0
Config/testthat/edition: 3
2 changes: 2 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ S3method("+",gg)
S3method("[",ggmatrix)
S3method("[",glyphplot)
S3method("[<-",ggmatrix)
S3method(as.character,ggmatrix_fn_with_params)
S3method(as.character,ggmatrix_plot_obj)
S3method(grid.draw,ggmatrix)
S3method(print,ggmatrix)
S3method(print,glyphplot)
Expand Down
11 changes: 10 additions & 1 deletion R/ggnet.R
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ ggnet <- function(

y = ifelse(is_dir == "digraph", "directed", "undirected")
z = c("indegree" = "in", "outdegree" = "out", "degree" = "all", "freeman" = "all")[x]
data$weight = igraph::degree(igraph::graph.adjacency(as.matrix(net), mode = y), mode = z)
data$weight = igraph::degree(igraph_graph_adjacency_matrix(as.matrix(net), mode = y), mode = z)

} else {
data$weight = sna::degree(net, gmode = is_dir, cmode = ifelse(x == "degree", "freeman", x))
Expand Down Expand Up @@ -736,3 +736,12 @@ ggnet <- function(
return(p)

}


igraph_graph_adjacency_matrix <- function(...) {
if (packageVersion("igraph") >= "2.0.0") {
igraph::graph_from_adjacency_matrix(...)
} else {
igraph::graph.adjacency(...)
}
}
2 changes: 1 addition & 1 deletion R/ggnet2.R
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ ggnet2 <- function(

y = ifelse(is_dir == "digraph", "directed", "undirected")
z = c("indegree" = "in", "outdegree" = "out", "degree" = "all", "freeman" = "all")[x]
data$size = igraph::degree(igraph::graph.adjacency(as.matrix(net), mode = y), mode = z)
data$size = igraph::degree(igraph_graph_adjacency_matrix(as.matrix(net), mode = y), mode = z)

} else {
data$size = sna::degree(net, gmode = is_dir, cmode = ifelse(x == "degree", "freeman", x))
Expand Down
4 changes: 3 additions & 1 deletion R/ggpairs_internal_plots.R
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ wrap_fn_with_param_arg <- function(
allParams$mapping <- mapping
argsList <- list(...)
allParams[names(argsList)] <- argsList
do.call(original_fn, allParams)
rlang::inject(original_fn(!!!allParams))
}

class(ret_fn) <- "ggmatrix_fn_with_params"
Expand Down Expand Up @@ -166,6 +166,7 @@ wrap <- function(funcVal, ..., funcArgName = deparse(substitute(funcVal))) {
wrap_fn_with_params <- wrap


#' @export
as.character.ggmatrix_fn_with_params <- function(x, ...) {
params <- attr(x, "params")
fnName <- attr(x, "name")
Expand Down Expand Up @@ -220,6 +221,7 @@ mapping_as_string <- function(mapping) {
str_c("c(", str_c(names(mapping), as.character(mapping), sep = " = ", collapse = ", "), ")")
}

#' @export
as.character.ggmatrix_plot_obj <- function(x, ...) {
hasGg <- (!is.null(x$gg))
mappingTxt <- mapping_as_string(x$mapping)
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/_snaps/gg-plots/cor-green.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion tests/testthat/_snaps/gg-plots/rescale-true.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions tests/testthat/_snaps/gg-plots/titanic-count-class.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions tests/testthat/_snaps/gg-plots/titanic-count-diag-class.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions tests/testthat/_snaps/gg-plots/titanic-count-diag.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions tests/testthat/_snaps/gg-plots/titanic-count-interaction.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions tests/testthat/_snaps/gg-plots/titanic-count-sex.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions tests/testthat/_snaps/gg-plots/titanic-count-toupper.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit ba17416

Please sign in to comment.