{"id":22305169,"url":"https://github.com/usccana/netplot","last_synced_at":"2025-07-04T01:34:33.754Z","repository":{"id":46865944,"uuid":"131054786","full_name":"USCCANA/netplot","owner":"USCCANA","description":"Beautiful graph drawing","archived":false,"fork":false,"pushed_at":"2024-11-15T15:40:57.000Z","size":120083,"stargazers_count":51,"open_issues_count":7,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-06-21T15:51:28.663Z","etag":null,"topics":["graph-visualization","igraph","netsci","network-analysis","network-visualization","rpackage","rstats","sna","statnet"],"latest_commit_sha":null,"homepage":"https://usccana.github.io/netplot/","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/USCCANA.png","metadata":{"files":{"readme":"README.md","changelog":"NEWS.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"gvegayon","patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":null}},"created_at":"2018-04-25T19:36:25.000Z","updated_at":"2025-04-21T14:03:44.000Z","dependencies_parsed_at":"2022-09-04T02:11:44.119Z","dependency_job_id":"935c1913-355c-4e8c-863a-8e56e2db1248","html_url":"https://github.com/USCCANA/netplot","commit_stats":{"total_commits":114,"total_committers":2,"mean_commits":57.0,"dds":0.07894736842105265,"last_synced_commit":"f1ff04b507bd07e0b00a44f12c0bd55753dc5d39"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/USCCANA/netplot","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/USCCANA%2Fnetplot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/USCCANA%2Fnetplot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/USCCANA%2Fnetplot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/USCCANA%2Fnetplot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/USCCANA","download_url":"https://codeload.github.com/USCCANA/netplot/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/USCCANA%2Fnetplot/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263431370,"owners_count":23465516,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["graph-visualization","igraph","netsci","network-analysis","network-visualization","rpackage","rstats","sna","statnet"],"created_at":"2024-12-03T19:10:13.960Z","updated_at":"2025-07-04T01:34:33.725Z","avatar_url":"https://github.com/USCCANA.png","language":"R","funding_links":["https://github.com/sponsors/gvegayon"],"categories":[],"sub_categories":[],"readme":"\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n[![CRAN\nstatus](https://www.r-pkg.org/badges/version/netplot)](https://cran.r-project.org/package=netplot)\n[![CRAN](https://cranlogs.r-pkg.org/badges/netplot)](https://cran.r-project.org/package=netplot)\n[![Downloads](https://cranlogs.r-pkg.org/badges/grand-total/netplot)](https://cran.r-project.org/package=netplot)\n[![R](https://github.com/USCCANA/netplot/actions/workflows/ci.yml/badge.svg)](https://github.com/USCCANA/netplot/actions/workflows/ci.yml)\n[![USC’s Department of Preventive\nMedicine](https://raw.githubusercontent.com/USCbiostats/badges/master/tommy-uscprevmed-badge.svg)](https://preventivemedicine.usc.edu)\n\n# netplot\n\nAn alternative graph visualization tool that emphasizes aesthetics,\nproviding default parameters that deliver out-of-the-box lovely\nvisualizations.\n\nSome features:\n\n1.  Auto-scaling of vertices using sizes relative to the plotting\n    device.\n2.  Embedded edge color mixer.\n3.  True curved edges drawing.\n4.  User-defined edge curvature.\n5.  Nicer vertex frame color.\n6.  Better use of space-filling the plotting device.\n\nThe package uses the `grid` plotting system (just like `ggplot2`).\n\n## Installation\n\nYou can install the released version of netplot from\n[CRAN](https://CRAN.R-project.org) with:\n\n``` r\ninstall.packages(\"netplot\")\n```\n\nAnd the development version from [GitHub](https://github.com/) with:\n\n``` r\n# install.packages(\"devtools\")\ndevtools::install_github(\"USCCANA/netplot\")\n```\n\n## Example\n\nThis is a basic example which shows you how to solve a common problem:\n\n``` r\nlibrary(igraph)\n#\u003e \n#\u003e Attaching package: 'igraph'\n#\u003e The following objects are masked from 'package:stats':\n#\u003e \n#\u003e     decompose, spectrum\n#\u003e The following object is masked from 'package:base':\n#\u003e \n#\u003e     union\nlibrary(netplot)\n#\u003e Loading required package: grid\n#\u003e \n#\u003e Attaching package: 'netplot'\n#\u003e The following object is masked from 'package:igraph':\n#\u003e \n#\u003e     ego\nset.seed(1)\ndata(\"UKfaculty\", package = \"igraphdata\")\nl \u003c- layout_with_fr(UKfaculty)\n#\u003e This graph was created by an old(er) igraph version.\n#\u003e   Call upgrade_graph() on it to use with the current igraph version\n#\u003e   For now we convert it on the fly...\n\nplot(UKfaculty, layout = l) # ala igraph\n```\n\n\u003cimg src=\"man/figures/README-example-1.png\" style=\"width:85.0%\" /\u003e\n\n``` r\n\nV(UKfaculty)$ss \u003c- runif(vcount(UKfaculty))\nnplot(UKfaculty, layout = l) # ala netplot\n```\n\n\u003cimg src=\"man/figures/README-example-2.png\" style=\"width:85.0%\" /\u003e\n\n``` r\nsna::gplot(intergraph::asNetwork(UKfaculty), coord=l)\n```\n\n\u003cimg src=\"man/figures/README-example-3.png\" style=\"width:85.0%\" /\u003e\n\n### UKfaculty\n\n``` r\n# Random names\nset.seed(1)\nnam \u003c- sample(babynames::babynames$name, vcount(UKfaculty))\n\nans \u003c- nplot(\n  UKfaculty,\n  layout                = l,\n  vertex.color          = ~ Group,\n  vertex.nsides         = ~ Group,\n  vertex.label          = nam,\n  vertex.size.range     = c(.01, .03, 4),\n  bg.col                = \"transparent\",\n  vertex.label.show     = .25,\n  vertex.label.range    = c(10, 25),\n  edge.width.range      = c(1, 4, 5),\n  vertex.label.fontfamily = \"sans\"\n  )\n\n# Plot it!\nans\n```\n\n\u003cimg src=\"man/figures/README-fig-uk-faculty-1.png\" id=\"fig-uk-faculty\"\nstyle=\"width:85.0%\" /\u003e\n\nStarting version 0.2-0, we can use gradients!\n\n``` r\nans |\u003e\n  set_vertex_gpar(\n    element = \"core\",\n    fill = lapply(get_vertex_gpar(ans, \"frame\", \"col\")$col, \\(i) {\n      radialGradient(c(\"white\", i), cx1=.8, cy1=.8, r1=0)\n      }))\n```\n\n\u003cimg src=\"man/figures/README-fig-uk-faculty-gradient-1.png\"\nid=\"fig-uk-faculty-gradient\" style=\"width:85.0%\" /\u003e\n\n### USairports\n\n``` r\n# Loading the data\ndata(USairports, package=\"igraphdata\")\n\n# Generating a layout naively\nlayout   \u003c- V(USairports)$Position\n#\u003e This graph was created by an old(er) igraph version.\n#\u003e   Call upgrade_graph() on it to use with the current igraph version\n#\u003e   For now we convert it on the fly...\nlayout   \u003c- do.call(rbind, lapply(layout, function(x) strsplit(x, \" \")[[1]]))\nlayout[] \u003c- stringr::str_remove(layout, \"^[a-zA-Z]+\")\nlayout   \u003c- matrix(as.numeric(layout[]), ncol=2)\n\n# Some missingness\nlayout[which(!complete.cases(layout)), ] \u003c- apply(layout, 2, mean, na.rm=TRUE)\n\n# Have to rotate it (it doesn't matter the origin)\nlayout \u003c- netplot:::rotate(layout, c(0,0), pi/2)\n\n# Simplifying the network\nnet \u003c- simplify(USairports, edge.attr.comb = list(\n  weight = \"sum\",\n  name   = \"concat\",\n  Passengers = \"sum\",\n  \"ignore\"\n))\n\n# Pretty graph\nnplot(\n  net,\n  layout            = layout,\n  edge.width        = ~ Passengers,\n  edge.color        = ~\n    ego(col = \"white\", alpha = 0) +\n    alter(col = \"yellow\", alpha = .75),\n  skip.vertex       = TRUE,\n  skip.arrows       = TRUE,\n  edge.width.range  = c(.75, 4, 4), \n  bg.col            = \"black\",\n  edge.line.breaks  = 10\n  )\n```\n\n\u003cimg src=\"man/figures/README-fig-us-airports-1.png\" id=\"fig-us-airports\"\nstyle=\"width:85.0%\" /\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fusccana%2Fnetplot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fusccana%2Fnetplot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fusccana%2Fnetplot/lists"}