Uh oh!
There was an error while loading. Please reload this page.
Improve documentation: nplot description, formula vignette, README, and pkgdown reference - #19
Conversation
…kgdown - Rewrite the vague nplot() description into a proper overview and document the formula interface (vertex.color/nsides/size and edge.width from graph attributes) in a dedicated "Mapping attributes with formulas" section, with a formula-based example. These param docs propagate to nplot_base via @inheritParams. - Expand netplot-formulae (ego()/alter()) docs with a details section and cross-links, clarifying it is the edge-color grammar. - Add a package-level help page (netplot-package). - Add _pkgdown.yml organizing the reference by feature, with nplot on top. - New vignette "formulas" demonstrating color/shape/size/width mapping. - Rewrite the README intro with a "Why netplot?" section and fuller feature list (README.qmd + README.md kept in sync). - Note the changes in NEWS.md. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Thank you for your contribution @gvegayon 🚀! The pkgdown site preview is ready for review 👉 Download here 👈! |
…color legend; v0.4-0 - Attribute formulas for edge.width, vertex.size, and vertex.nsides now evaluate the RHS against the graph's attributes, so expressions like `~ log1p(weight)` or `~ degree ^ 2` work, not just bare names. Previously any non-trivial RHS failed with a cryptic "the condition has length > 1" (as.character() on a call produced a multi-element vector). Missing attributes now raise a clear, informative error. Adds eval_attribute_formula() / all_graph_attributes() and regression tests. - vertex.color = ~ attr now picks a legend by attribute type: categorical key for discrete (factor/logical/low-cardinality integer), continuous color bar for continuous attributes (numeric / high-cardinality integer). - Bump version to 0.4-0 and split NEWS so 0.3-0 lists only the released items; unreleased fixes and the new work move under 0.4-0. - Document expression support and the continuous legend in nplot() and the formulas vignette. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
gvegayon
commented
Jul 22, 2026
Round 2: formula fix, continuous legend, version bumpFollow-up to the review comments: 1. |
R CMD check builds all vignettes in a single R session. examples.Rmd attaches sna (which defines its own degree()) above igraph, so the bare degree(UKfaculty, mode = "in") in formulas.Rmd resolved to sna::degree and failed with "unused argument (mode = "in")". Qualify igraph::degree() (and stats::median()) so the vignette is robust to search-path order. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The \VignetteIndexEntry{} ("Example with baseplots") differed from the YAML
title ("Mixing netplot with base graphics"), which raised a check warning.
Use the YAML title for both.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>Uh oh!
There was an error while loading. Please reload this page.
This PR focuses on documentation and discoverability, as requested.
What's included
1. Better README
gridintegration, small dependency footprint).README.qmdandREADME.mdkept in sync (only prose changed, no code chunks).2. Organized pkgdown reference
_pkgdown.ymlgroups exported functions by feature, withnploton top as the main function. Groups: Drawing networks → Mapping attributes with formulas → Editing and querying a plot → Legends and color keys → Colors → Low-level drawing primitives → Base-graphics backend.pkgdown::check_pkgdown()(all exported topics accounted for).3. Improved Rd files (roxygen)
nplot()'s placeholder description ("This is a description.") is replaced with a real overview, plus a "Mapping attributes with formulas" section documentingvertex.color/vertex.nsides/vertex.size/edge.widthformula support. Param docs updated (and propagate tonplot_basevia@inheritParams).netplot-formulae(theego()/alter()edge-color grammar) gains a details section and cross-links.?netplot-package).nplot()example now shows the formula interface.4. New "formulas" vignette
vignettes/formulas.Rmdwalks through mapping color, shape, and size from graph attributes, plus theego()/alter()edge-color grammar and applying formulas after the fact withset_vertex_gpar(). Renders cleanly.Suggestions for further improvements (not in this PR)
A few ideas that came up while reading the code, happy to open issues / follow-up PRs:
vertex.size = ~ f(attr)doesn't work — the formula RHS is taken literally as an attribute name, so~ degree(x)fails. Supporting evaluated expressions (à laigraph/ggplot2aesthetics) would be a nice ergonomic win.vertex.colorformulas draw a legend onprint(), but numeric ones would benefit from a color-key legend (colorkey()already exists to build on).roxygen2(8.0.0) warns thatget_vertex_attribute.*,get_edge_attribute.*, andcolor_nodes.*need@export/@exportS3Method/@noRd. Cheap cleanup to silencedevtools::check()NOTEs.color_nodes()is powerful but unexported — exposing it (or documentingvertex.color = color_nodes(...)) would let users control palettes/na_colordirectly.Notes / please double-check
https://usccana.github.io/netplot/(standard GitHub Pages pattern for theUSCCANAorg) in both_pkgdown.ymlandDESCRIPTION. Please adjust if the site lives elsewhere.roxygen2::roxygenize()(per theMakefile/AGENTS.mdworkflow) bumped the recorded roxygen version inDESCRIPTION(RoxygenNote→Config/roxygen2/version: 8.0.0) since 8.0.0 is installed locally, and normalized a couple of unrelated\link{}anchors in existing Rd files.Testing
tinytestsuite: 22/22 pass.nplot()Rd example and every vignette code chunk verified to run.pkgdown::check_pkgdown()passes.🤖 Generated with Claude Code