Conversation
…ive correction
|
@copilot can you please update the NEWS.md based on changes in this PR? |
Co-authored-by: jhollway <5595229+jhollway@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR appears to cut a v1.0.0 release by bumping package metadata and aligning plots/docs/tests with updated dependencies and theming behavior (notably moving several plotting helpers into a new analysis-focused file and updating examples to use {netrics} APIs).
Changes:
- Bump package version/date to
1.0.0and add{netrics}to Suggests. - Refactor plotting code by moving measure/membership/motif plotting methods into
R/plot_analysis.Rand updating related.Rdsources. - Improve theming/font consistency across multiple plot methods and update tutorials/examples to use the correct ggplot2 aesthetics (
fill).
Reviewed changes
Copilot reviewed 22 out of 22 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/testthat/test-plot_manynet.R | Update plotting tests to use {netrics} measure functions. |
| man/theme_set.Rd | Update examples to use {netrics} and adjust theme example. |
| man/plot_graphr.Rd | Update example to reference netrics::node_is_cutpoint(). |
| man/plot.network_test.Rd | Update roxygen “Please edit documentation in …” source pointer. |
| man/plot.diffusion.Rd | Update roxygen “Please edit documentation in …” source pointer. |
| man/model_mrqap.Rd | Update roxygen “Please edit documentation in …” source pointer. |
| man/map_motifs.Rd | Update roxygen “Please edit documentation in …” source pointer. |
| man/map_member.Rd | Update examples to use {netrics} community output. |
| man/map_measure.Rd | Update examples to use {netrics} measure functions. |
| inst/tutorials/tutorial2/visualisation.Rmd | Clarify that node color maps to fill; switch to scale_fill_*() examples. |
| R/zzz.R | Adjust startup message to report stocnet_theme option. |
| R/theme_set.R | Update examples to use {netrics} and change theme shown. |
| R/plot_tests.R | Apply ag_font() via base_family in ggplot2 themes for test plots. |
| R/plot_summaries.R | Remove measure/membership/motif plotting code (moved to plot_analysis). |
| R/plot_interp.R | Standardize theme option key (stocnet_theme) and set font via theme text element. |
| R/plot_gof.R | Adjust GOF plotting label handling and title construction; tweak messaging. |
| R/plot_analysis.R | New file containing measure/membership/motif plot methods previously in plot_summaries. |
| R/grapht.R | Switch isolate detection to internal helper. |
| R/graphr.R | Add internal .node_is_isolate() helper and use it in isolate handling. |
| R/graph_nodes.R | Add internal adoption-time helper and expand shape scale values. |
| R/autograph-package.R | Add additional globals used by new adoption-time helper. |
| DESCRIPTION | Bump to 1.0.0 / update date; add {netrics} to Suggests. |
Comments suppressed due to low confidence (1)
R/plot_gof.R:176
plot.sienaGOF()referencesperiodbut it is not defined in the function or derived from..., so this will error whenattr(x, "joined")is FALSE. Define a default period (e.g., 1) and/or acceptperiodas an argument (pulled fromlist(...)) before using it.
if (is.null(args$main)) {
statName <- tolower(add_spaces(attr(x, "auxiliaryStatisticName")))
main <- paste("Goodness of fit of", statName)
if (!attr(x, "joined")) {
main <- paste(main, "Period", period)
}
} else {
main = args$main
}
if (attr(x, "joined")) {
x <- x[[1]]
} else {
x <- x[[period]]
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| snet_info("You are using {.pkg autograph} version {.version {local_version}}.") | ||
| old.list <- as.data.frame(utils::old.packages()) | ||
| behind_cran <- "autograph" %in% old.list$Package | ||
| curr_theme <- getOption('stocnet_theme') |
| plot.ag_gof <- function(x, ...){ | ||
| obs <- x[[1]] | ||
| sims <- x[[2]] | ||
| if(all(!is.na(suppressWarnings(as.numeric(sims$name))))){ |
| if (!is.null(membership)) | ||
| if(!is.numeric(membership)) membership <- as.numeric(as.factor(membership)) | ||
| g <- g + ggplot2::geom_vline( | ||
| xintercept = c(1 + which(diff(membership[order(membership)]) != 0)) - .5, | ||
| colour = ag_highlight() | ||
| ) + | ||
| ggplot2::geom_hline( | ||
| yintercept = nrow(blocked_data) - | ||
| c(1 + which(diff(membership[order(membership)]) != 0)) + 1.5, | ||
| colour = ag_highlight() | ||
| ) | ||
| } else { | ||
| group_boundaries <- diff(as.numeric(factor(membership[order(membership)]))) | ||
| g <- g + | ||
| ggplot2::scale_y_discrete(expand = c(0, 0), | ||
| limits = rev(rownames(blocked_data)) | ||
| ) + | ||
| ggplot2::scale_x_discrete(expand = c(0, 0), position = "top", | ||
| limits = colnames(blocked_data) | ||
| ) + | ||
| ggplot2::geom_vline( | ||
| xintercept = | ||
| c(1 + which(group_boundaries != 0)) - .5, | ||
| colour = ag_positive() | ||
| ) + | ||
| ggplot2::geom_hline( | ||
| yintercept = nrow(blocked_data) - | ||
| c(1 + which(group_boundaries != 0)) + 1.5, | ||
| colour = ag_negative() | ||
| ) |
| #' These functions plot distributions for node, tie, and network measures, | ||
| #' as defined in the `{manynet}` package. |
| p <- p + ggplot2::scale_shape_manual(values = c(21, 22, 24, 23, 25, | ||
| 3, 4, 8, | ||
| 10, 12, 9, | ||
| 13, 7, 11, 14)) |
| test_that("plotting node measures works", { | ||
| p <- plot(manynet::node_deg(ison_dolphins)) | ||
| p <- plot(netrics::node_by_deg(ison_dolphins)) | ||
| expect_s3_class(p, "ggplot") | ||
| }) | ||
|
|
||
| test_that("plotting tie measures works", { | ||
| p <- plot(manynet::tie_betweenness(ison_dolphins)) | ||
| p <- plot(netrics::tie_by_betweenness(ison_dolphins)) | ||
| expect_s3_class(p, "ggplot") |
When both node_color and node_shape are mapped, ggplot2 creates separate legends. The fill legend defaults to shape 19 (solid circle) which uses the 'colour' aesthetic instead of 'fill', making all legend points black. Adding override.aes = list(shape = 21) ensures the fill legend always uses a fillable shape so the mapped colors are visible. Co-authored-by: jhollway <5595229+jhollway@users.noreply.github.com> Agent-Logs-Url: https://github.com/stocnet/autograph/sessions/6d9ee1a4-5535-480a-be4a-45aee4c7b3c7
…toring until after filtering Co-authored-by: jhollway <5595229+jhollway@users.noreply.github.com> Agent-Logs-Url: https://github.com/stocnet/autograph/sessions/3d6b251d-4950-4ebc-8306-38fbab33d487
…ndering' into develop
…atistics' into develop
- Return ggplot2+gganimate object instead of rendered gif (#17) - Add print.grapht() S3 method for automatic animation - Use fill aesthetic, same palettes, and ag_font() like graphr() - Convert list elements to tidygraph for S4 compatibility (#40) - Add label_dist parameter to graphr() and graph_labels() (#52) - Improve concentric label placement with point.padding (#10) - Update documentation for graphr, grapht, and graph_labels" Agent-Logs-Url: https://github.com/stocnet/autograph/sessions/72251800-fba5-427c-bf1a-63b9f2c9a960 Co-authored-by: jhollway <5595229+jhollway@users.noreply.github.com>
Agent-Logs-Url: https://github.com/stocnet/autograph/sessions/72251800-fba5-427c-bf1a-63b9f2c9a960 Co-authored-by: jhollway <5595229+jhollway@users.noreply.github.com>
…o-grapht' into develop
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #42 +/- ##
==========================================
- Coverage 56.86% 56.30% -0.57%
==========================================
Files 23 24 +1
Lines 1843 1920 +77
==========================================
+ Hits 1048 1081 +33
- Misses 795 839 +44 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Description
Package
Graphing
node_shapeto accept more categoriesnode_is_isolateandnode_adoption_timeto internal helpers to reduce dependenciesgraphr(), color legend renders all points in black #47 color legend not showing colors by overriding shape to fillable (21)Plotting
.to_factor()inplot.ag_gof()to correct numeric ordering of statistics, and dropped cumulative correction inplot.sienaGOF()plot.influenceTable()snet_themetostocnet_themeinplot.selectionTable()andplot.influenceTable()ag_font()to migraph model plots for consistent typographyplot.gof.ergm()displaying shifted/distorted observed values for degree distributions, shared partners, and geodesic distance #46 by not appending "X" to the names when creating the data frame and moving factor coercion later in the processTutorial
scale_fill_*()) instead of colour aesthetics (scale_colour_*())Checklist: