{"id":13689598,"url":"https://github.com/schochastics/roughnet","last_synced_at":"2025-04-22T12:23:07.151Z","repository":{"id":56742321,"uuid":"275009864","full_name":"schochastics/roughnet","owner":"schochastics","description":"R package to draw sketchy, hand-drawn-like networks with roughjs","archived":false,"fork":false,"pushed_at":"2024-09-23T18:58:59.000Z","size":2291,"stargazers_count":84,"open_issues_count":1,"forks_count":4,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-22T14:06:20.881Z","etag":null,"topics":["network-analysis","roughjs","rstats"],"latest_commit_sha":null,"homepage":"https://schochastics.github.io/roughnet/","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/schochastics.png","metadata":{"files":{"readme":"README.Rmd","changelog":"NEWS.md","contributing":null,"funding":null,"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}},"created_at":"2020-06-25T20:34:28.000Z","updated_at":"2025-01-23T19:43:43.000Z","dependencies_parsed_at":"2024-10-26T20:29:02.637Z","dependency_job_id":"681bf14b-be01-4819-8a51-3c71d55c3d70","html_url":"https://github.com/schochastics/roughnet","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/schochastics%2Froughnet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/schochastics%2Froughnet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/schochastics%2Froughnet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/schochastics%2Froughnet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/schochastics","download_url":"https://codeload.github.com/schochastics/roughnet/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246200315,"owners_count":20739566,"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":["network-analysis","roughjs","rstats"],"created_at":"2024-08-02T15:01:54.986Z","updated_at":"2025-03-29T15:05:34.308Z","avatar_url":"https://github.com/schochastics.png","language":"R","funding_links":[],"categories":["R"],"sub_categories":[],"readme":"---\noutput: github_document\n---\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r, include = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"man/figures/README-\",\n  out.width = \"100%\"\n)\n```\n\n# roughnet \u003cimg src=\"man/figures/logo.png\" align=\"right\" width=\"120px\"/\u003e\n\n\u003c!-- badges: start --\u003e\n[![R-CMD-check](https://github.com/schochastics/roughnet/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/schochastics/roughnet/actions/workflows/R-CMD-check.yaml)\n[![CRAN status](https://www.r-pkg.org/badges/version/roughnet)](https://CRAN.R-project.org/package=roughnet)\n[![CRAN Downloads](https://cranlogs.r-pkg.org/badges/roughnet)](https://CRAN.R-project.org/package=roughnet)\n\u003c!-- badges: end --\u003e\n\nUsing the java script library [rough.js](https://roughjs.com/) to draw sketchy, hand-drawn-like networks.  \n(*Checkout [ggrough](https://xvrdm.github.io/ggrough/) for turning general ggplot objects into sketchy drawings*)  \n\n\n![](man/figures/example.png)\n\n## Installation\n\nYou can install the developers version of roughnet with:\n\n```{r eval=FALSE}\n# install.packages(\"remotes\")\nremotes::install_github(\"schochastics/roughnet\")\n```\n\n## Example\n\nThe package currently only works with {{igraph}} objects by setting styling elements as vertex/edge attributes.\n\n```{r example,eval = FALSE}\nlibrary(roughnet)\nlibrary(igraph)\n\ng \u003c- make_graph(\"Zachary\")\nV(g)$shape \u003c- \"circle\"\nV(g)$shape[c(1,34)] \u003c- \"rectangle\"\nV(g)$fill \u003c- c(\"#E41A1C\", \"#377EB8\", \"#4DAF4A\", \"#984EA3\")[membership(cluster_louvain(g))]\nV(g)$fillstyle \u003c- c(\"hachure\", \"zigzag\", \"cross-hatch\", \"dots\")[membership(cluster_louvain(g))]\nV(g)$color \u003c- \"black\"\nV(g)$size \u003c- 30\nV(g)$stroke \u003c- 2\nE(g)$color \u003c- \"#AEAEAE\"\nroughnet(g,width = 960,height = 600)\n```\n\n![](man/figures/karate.png)\n\nYou can save the plot with the function `save_roughnet()` (needs {{pagedown}} to be installed.)\n```{r example_save, eval=FALSE}\n# install.packages(\"pagedown\")\np \u003c- roughnet(g,width = 960,height = 600)\nsave_roughnet(p,\"karate.png\")\n```\n\n## Extended Example\n\nThe package also allows to place labels in or around vertices and implements some custom vertex shapes.\n```{r avatar,eval = FALSE}\n# install.packages(c(\"signnet\",\"graphlayouts\"))\nlibrary(signnet)\nlibrary(graphlayouts)\nlibrary(dplyr)\n\ndata(\"avatar\") # Allies/Enemies relations in Avatar: The Last Airbender\n\nmain \u003c- induced_subgraph(avatar,which(V(avatar)$main)) #only use the main characters\n\n#calculate layout\nw \u003c- ifelse(E(main)$sign==1,3,1)\nxy \u003c- layout_with_stress(main,weights = 1/w)\n\nV(main)$x \u003c- xy[,1]\nV(main)$y \u003c- xy[,2]\n\nV(main)$fill \u003c- case_when(V(main)$affiliation==\"earth kingdom\"~\"#8B6914\",\n                          V(main)$affiliation==\"fire nation\"~\"#CD2626\",\n                          V(main)$affiliation==\"water tribe\"~\"white\",\n                          V(main)$affiliation==\"air nomad\"~\"#98F5FF\",\n                       TRUE~\"grey\"\n)\n\nV(main)$color \u003c- case_when(V(main)$affiliation==\"earth kingdom\"~\"#8B6914\",\n                          V(main)$affiliation==\"fire nation\"~\"#CD2626\",\n                          V(main)$affiliation==\"water tribe\"~\"#1874CD\",\n                          V(main)$affiliation==\"air nomad\"~\"#98F5FF\",\n                          TRUE~\"grey\"\n)\n\nV(main)$shape \u003c- case_when(V(main)$affiliation==\"earth kingdom\"~\"earth\",\n                           V(main)$affiliation==\"fire nation\"~\"fire\",\n                           V(main)$affiliation==\"water tribe\"~\"water\",\n                           V(main)$affiliation==\"air nomad\"~\"air\",\n                           TRUE~\"circle\"\n)\n\n\nE(main)$width \u003c- ifelse(E(main)$sign==1,1.2,0.3)\nE(main)$color \u003c- ifelse(E(main)$sign==1,\"#228B22\",\"#CD3278\")\nV(main)$label \u003c- V(main)$name\n# position labels in the (c)enter of the vertex or (n)orth, (e)ast, (s)outh, or (w)est of it \nV(main)$pos \u003c- c(\"n\",\"s\",\"s\",\"s\",\"s\",\"e\",\"n\",\"e\",\"s\",\"n\") \n\nroughnet(main, width = 600, height=600, font = \"30px Herculanum\")\n```\n\n\n![](man/figures/avatar.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fschochastics%2Froughnet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fschochastics%2Froughnet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fschochastics%2Froughnet/lists"}