Skip to content

Fix edge.width not applied to drawn line widths in nplot#18

Open
gvegayon with Copilot wants to merge 7 commits into
masterfrom
copilot/fix-edge-width-issue
Open

Fix edge.width not applied to drawn line widths in nplot#18
gvegayon with Copilot wants to merge 7 commits into
masterfrom
copilot/fix-edge-width-issue

Conversation

Copilot AI commented Jun 30, 2026

Copy link
Copy Markdown

edge.width values were rescaled correctly inside nplot.default but only set during grob creation in grob_edge.R. The post-processing step that applies col via set_edge_gpar had no equivalent for lwd, making widths unreliable.

Changes

  • R/netplot.R — After all color post-processing in nplot.default, explicitly apply rescaled edge.width via set_edge_gpar(lwd = ...) for both "line" and "arrow" elements:
    if (!skip.edges)
      ans <- set_edge_gpar(x = ans, element = "line", lwd = as.vector(netenv$edge.width))
    if (!skip.arrows)
      ans <- set_edge_gpar(x = ans, element = "arrow", lwd = as.vector(netenv$edge.width))
  • R/netplot.R — Improved @param docs for edge.width and edge.width.range to clarify normalization and range mapping behavior.
  • vignettes/examples.Rmd — Added "Edge width" section demonstrating edge.width, edge.width.range, and post-hoc set_edge_gpar() usage.
  • inst/tinytest/test_netplot.R — Test that lwd values retrieved via get_edge_gpar fall within the specified edge.width.range and are monotonically non-decreasing with weight.
  • NEWS.md — Changelog entry for the fix.

Copilot AI linked an issue Jun 30, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Fix issue with edge width not being used in nplot function Fix edge.width not applied to drawn line widths in nplot Jun 30, 2026
Copilot AI requested a review from gvegayon June 30, 2026 01:15
@gvegayon gvegayon marked this pull request as ready for review June 30, 2026 01:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

edge width is not used

2 participants