{"id":33187039,"url":"https://stocnet.github.io/autograph/","last_synced_at":"2025-11-20T23:01:06.751Z","repository":{"id":268150864,"uuid":"894405290","full_name":"stocnet/autograph","owner":"stocnet","description":"Automatic Plotting of Many Graphs","archived":false,"fork":false,"pushed_at":"2025-11-18T13:17:33.000Z","size":12062,"stargazers_count":1,"open_issues_count":11,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-11-18T15:59:48.575Z","etag":null,"topics":["cran","graphs","network","plotting","r"],"latest_commit_sha":null,"homepage":"https://stocnet.github.io/autograph/","language":"HTML","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/stocnet.png","metadata":{"files":{"readme":"README.Rmd","changelog":"NEWS.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-11-26T09:53:13.000Z","updated_at":"2025-11-12T16:59:41.000Z","dependencies_parsed_at":"2024-12-14T18:33:30.396Z","dependency_job_id":"eb25c6da-05d7-42cb-8a40-6ba87952c4a3","html_url":"https://github.com/stocnet/autograph","commit_stats":null,"previous_names":["stocnet/autograph"],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/stocnet/autograph","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stocnet%2Fautograph","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stocnet%2Fautograph/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stocnet%2Fautograph/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stocnet%2Fautograph/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stocnet","download_url":"https://codeload.github.com/stocnet/autograph/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stocnet%2Fautograph/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":285231839,"owners_count":27136540,"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","status":"online","status_checked_at":"2025-11-19T02:00:05.673Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["cran","graphs","network","plotting","r"],"created_at":"2025-11-16T05:00:30.369Z","updated_at":"2025-11-20T23:01:06.734Z","avatar_url":"https://github.com/stocnet.png","language":"HTML","funding_links":[],"categories":["Presentation, composition and scales"],"sub_categories":[],"readme":"---\noutput: github_document\n---\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)\nlibrary(autograph)\nlibrary(patchwork)\nlist_functions \u003c- function(string){\n  paste0(\"`\", paste(paste0(ls(\"package:autograph\")[grepl(string, ls(\"package:autograph\"))], \"()\"), collapse = \"`, `\"), \"`\")\n}\nlist_data \u003c- function(string){\n  paste0(\"`\", paste(paste0(ls(\"package:autograph\")[grepl(string, ls(\"package:autograph\"))]), collapse = \"`, `\"), \"`\")\n}\n```\n\n# autograph \n\u003cimg src=\"man/figures/logo.png\" align=\"right\" alt=\"autograph logo\" width=\"150\"/\u003e\n\n\u003c!-- badges: start --\u003e\n[![Lifecycle: maturing](https://img.shields.io/badge/lifecycle-maturing-blue.svg)](https://lifecycle.r-lib.org/articles/stages.html#maturing)\n![CRAN/METACRAN](https://img.shields.io/cran/v/autograph)\n![GitHub release (latest by date)](https://img.shields.io/github/v/release/stocnet/autograph)\n![GitHub Release Date](https://img.shields.io/github/release-date/stocnet/autograph)\n[![Codecov test coverage](https://codecov.io/gh/stocnet/autograph/branch/main/graph/badge.svg)](https://app.codecov.io/gh/stocnet/autograph?branch=main)\n\u003c!-- [![CodeFactor](https://www.codefactor.io/repository/github/stocnet/manynet/badge)](https://www.codefactor.io/repository/github/stocnet/manynet) --\u003e\n\u003c!-- [![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/4559/badge)](https://bestpractices.coreinfrastructure.org/projects/4559) --\u003e\n\u003c!-- [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.7076396.svg)](https://doi.org/10.5281/zenodo.7076396) --\u003e\n\u003c!-- see https://zenodo.org/record/7076396 --\u003e\n\u003c!-- ![GitHub All Releases](https://img.shields.io/github/downloads/stocnet/migraph/total) --\u003e\n\u003c!-- badges: end --\u003e\n\n## About the package\n\nThis package aims to make network visualisation _easier_, _succinct_,\nand _consistent_.\nVisualisation is a key part of the research process,\nfrom the initial exploration of data to the analysis of results\nand the presentation of findings in publications.\nHowever, it is often a tedious and time-consuming task.\nTrying to wrangle these into a consistent style for publication or presentation\ncan be frustrating and requires a lot of code.\nWhile there are a number of excellent packages for network analysis in R,\nthey each face several of the following challenges when it comes to visualisation:\n\n- defaults are often not sensible for different types of networks\n- customisation can sometimes be difficult\n- some require multiple lines of code to even produce a graph or plot\n- most require multiple lines of code to produce a graph or plot that is\nstyled suitable for publication or presentation\n- such style code needs to be repeated every time a graph or plot is produced \nif a consistent style is to be maintained\n- defaults and syntax are different for different packages, \nso a workflow using multiple packages must adapt to multiple syntaxes\n- different visual defaults can frustrate interpretation,\nand potentially invites errors when comparing plots from different packages\n- some plotting methods are available for some networks or network-related \nresults and not others\n\n`{autograph}` aims to solve these problems by providing automatic graph drawing\nfor networks in any of the `{manynet}` formats,\nand automatic plotting for results from `{stocnet}` packages, including `{migraph}`, `{RSiena}`, and `{MoNAn}`, and more.\n\nAll you need to do is install the package \n(loading it last will make sure its plotting methods are the default), \nuse `set_stocnet_theme()` (once) to set your preferred theme,\nand then use `graphr()` to graph your networks,\nor `plot()` to plot your results.\nThat's it!\n\n## Drawing graphs\n\n`{autograph}` includes three one-line graphing functions with sensible defaults \nbased on the network's properties.\n\nFirst, `graphr()` is used to graph networks in any of the `{manynet}` formats.\nBecause it builds upon `{manynet}`, it can graph networks in any of the `{manynet}` formats, including `network`, `igraph`, `sna`, `tidygraph`, and more.\n\nSecond, it includes sensible defaults so that researchers can view their network's structure\nor distribution quickly with a minimum of fuss.\nCompare the output from `{autograph}` with a similar default from `{igraph}`:\n\n\u003cimg src=\"https://www.jameshollway.com/post/manynet/README-layout-comparison-1.png\" alt=\"Example illustrating differences in default igraph and autograph graphs\"/\u003e\n\n```{r layout-comparison, echo = FALSE, message=FALSE, dpi = 250, fig.height=4, fig.width=12, eval=FALSE}\nlibrary(autograph)\nlibrary(igraph)\nlibrary(gridBase)\nlibrary(grid)\n\npar(mfrow=c(1, 2), mai = c(0,0,0.5,0))\nplot(as_igraph(ison_southern_women), layout = layout_as_bipartite, main = \"{igraph} bipartite\")\n## the last one is the current plot\nplot.new()              ## suggested by @Josh\nvps \u003c- baseViewports()\npushViewport(vps$figure) ##   I am in the space of the autocorrelation plot\nvp1 \u003c-plotViewport(c(1.8,1,0,1)) ## create new vp with margins, you play with this values \np \u003c- graphr(ison_southern_women) + ggtitle(\"{autograph} twomode\") + guides(shape = \"none\")\nprint(p,vp = vp1) \n```\n\n`{igraph}` requires the bipartite layout to be specified, \nhas cumbersome node size defaults for all but the smallest graphs, \nand labels also very often need resizing and adjustment to avoid overlap.\nGetting this default plot to look good can take a lot of trial and error, and time.\nBy contrast, `graphr()` recognises the network as two-mode \nand uses a bipartite layout by default.\nIt also recognises that the network contains names for the nodes and\nprints them vertically so that they are legible in this layout.\nOther 'clever' features include automatic node sizing and more.\n\n### More options\n\nAll of `graphr()`'s adjustments can be overridden, however...\nChanging the size and colors of nodes and ties is as easy as \nspecifying the function's relevant argument with a replacement,\ne.g. `node_color = \"darkblue\"` or `node_size = 6`,\nor indicating from which attribute it should inherit this information,\ne.g. `node_color = \"Office\"` or `node_size = \"Seniority\"`.\n\n\u003cimg src=\"https://www.jameshollway.com/post/manynet/README-more-options-1.png\" alt=\"Graph illustrating automatic and manual use of node color and size\"/\u003e\n\n```{r more-options, echo = FALSE, message=FALSE, dpi = 300, fig.height=3, eval=FALSE}\ngraphr(ison_lawfirm, node_color = \"darkblue\", node_size = 6) + \n  ggtitle(\"Manual options\", \n          subtitle = \"graphr(ison_lawfirm, node_color = 'darkblue', node_size = 6)\") +\ngraphr(mutate(ison_lawfirm, Seniority = Seniority/3), node_color = \"Office\", node_size = \"Seniority\") + \n  ggtitle(\"Automatic options\", \n          subtitle = \"graphr(ison_lawfirm, node_color = 'Office', node_size = 'Seniority')\") \u0026 \n  theme(plot.subtitle = element_text(size = 8))\n```\n\nLegends are added by default when node or tie aesthetics are mapped to attributes,\nbut can be removed with `show_legend = FALSE`.\nSince the `{autograph}` builds upon `{ggplot2}`, titles, subtitles and, for plotting, axis labels can all be added on easily,\nor other elements (e.g. font size) can be tweaked for a particular output.\n\n### More layouts\n\n`graphr()` can use all the layout algorithms offered by packages such as `{igraph}`, `{ggraph}`, and `{graphlayouts}`.\n`{autograph}` also offers some additional layout algorithms for\nvisualising partitions horizontally, vertically, or concentrically,\nconforming to configurational coordinates,\nor for snapping these layouts to a grid.\n\n\u003cimg src=\"https://www.jameshollway.com/post/manynet/README-more-layouts-1.png\" alt=\"Graphs illustrating different layouts\"/\u003e\n\n```{r more-layouts, echo = FALSE, message=FALSE, dpi = 250, eval=FALSE}\n(graphr(ison_southern_women, layout = \"concentric\") + ggtitle(\"Concentric layout\")) /\n  ((graphr(to_unnamed(create_explicit(A-+B-+C, A-+C))) + ggtitle(\"Triad layout\")) |\n  (graphr(to_unnamed(create_explicit(A-+C, A-+D, B-+C, B-+D))) + ggtitle(\"Quad layout\")))\n```\n\n### More networks\n\nThe second graph drawing function included, `graphs()`, \nis used to graph multiple networks together.\nThis can be useful for ego networks or network panels.\n`{patchwork}` is used to help arrange individual plots together,\nand is used throughout the package to help arrange plots together informatively.\n\n\u003cimg src=\"https://www.jameshollway.com/post/manynet/README-autographs-1.png\" alt=\"Example of graphs() used on longitudinal data\"/\u003e\n\n```{r autographs, echo = FALSE, dpi = 250, fig.height=3, eval=FALSE}\nison_adolescents %\u003e%\n  mutate_ties(wave = c(rep(1995, 5), rep(1998, 5))) %\u003e%\n  to_waves(attribute = \"wave\", panels = c(1995, 1998)) %\u003e%\n  graphs()\n```\n\n### More time\n\nThe third graph drawing function, `grapht()`, \nis used to visualise dynamic networks.\nIt uses `{gganimate}` and `{gifski}` to create a gif that\nvisualises network changes over time.\nIt really couldn't be easier.\n\n\u003cimg src=\"https://www.jameshollway.com/post/manynet/README-autographd-1.gif\" alt=\"Example of grapht() on longitudinal data\"/\u003e\n\n```{r autographd, echo = FALSE, dpi = 250, fig.height=3.5, eval=FALSE}\nison_adolescents %\u003e%\n  mutate_ties(year = sample(1995:1998, 10, replace = TRUE)) %\u003e%\n  to_waves(attribute = \"year\") %\u003e%\n  grapht()\n```\n\n\u003c!-- provide a common set of tools that can be used to import, export, create, and manipulate network data in a wide variety of formats, --\u003e\n\u003c!-- and obtain a good first visualisation quickly. --\u003e\n\u003c!-- This can be useful for pedagogical purposes, initial description, or checking something part way through the modelling process. --\u003e\n\u003c!-- Through the most comprehensive network class-coercion available, --\u003e\n\u003c!-- users can access routines not available in their chosen package or even in `{manynet}`. --\u003e\n\n\u003c!-- `{manynet}` provides a common set of tools and a standard syntax for analysing many different types of networks. --\u003e\n\u003c!-- It offers a broad range of functions to make, manipulate, map, measure, and model: --\u003e\n\n\u003c!-- - one-, two-, and sometimes three-mode networks --\u003e\n\u003c!-- - undirected, directed, and sometimes complex networks --\u003e\n\u003c!-- - unweighted, weighted, and sometimes signed networks --\u003e\n\n## Generating plots\n\nSince network analysis involves not just drawing graphs,\n`{autograph}` also provides a function for plotting results \nfrom the analysis or modelling of those networks.\nTo keep things simple, all users need to remember is a single, generic function:\n`plot()`.\nMethod dispatching takes care of the rest,\nso you can concentrate on exploring and interpreting your results.\nHere are some examples, using goodness-of-fit results from fitting a SAOM\nin `{RSiena}` and an ERGM in `{ergm}`. \n(Note that neither the data nor the model are similar;\nthis is just for illustrative purposes.)\n\n```{r siena-ergm-gof, echo = FALSE, dpi = 250, fig.height=2.5, message=FALSE}\nplot(siena_gof) + ggtitle(\"SAOM goodness-of-fit\")\nplot(ergm_gof) + ggtitle(\"ERGM goodness-of-fit\")\n```\n\n### Setting a theme\n\nNote that in the above plots, the same colour scheme and fonts were used.\nThey can be easily changed though.\n`{autograph}` includes a number of themes that can be used to style all graphs and plots consistently.\nAnd it is very easy to set a theme.\nJust type `stocnet_theme()` to see which is the theme currently set,\nand to get a list of available themes.\nThen enter the chosen theme name in the function to set it.\nAll plots created using `{autograph}` functions will then use this theme,\nuntil you change it again.\n\n```{r themeset, dpi = 300, fig.height=5, fig.alt=\"Themed figures\"}\nstocnet_theme()\n(plot(node_degree(ison_karateka)) + \nplot(tie_betweenness(ison_karateka)))/\n(plot(node_in_regular(ison_southern_women, \"e\")) + \nplot(as_matrix(ison_southern_women),\n     membership = node_in_regular(ison_southern_women, \"e\")))\nstocnet_theme(\"ethz\")\n(plot(node_degree(ison_karateka)) + \nplot(tie_betweenness(ison_karateka)))/\n(plot(node_in_regular(ison_southern_women, \"e\")) + \nplot(as_matrix(ison_southern_women),\n     membership = node_in_regular(ison_southern_women, \"e\")))\n```\n\nThere are a range of institutional and topical themes available,\nincluding `r autograph:::theme_opts`,\nwith more on the way.\n\n```{r theme-opts, echo=FALSE, dpi = 300, fig.height=3, fig.width=8, fig.alt=\"Institutional themes\"}\nset_stocnet_theme(\"iheid\")\nai \u003c- autograph:::ggpizza(ag_qualitative()) + ggtitle(\"IHEID\") + \n  theme(plot.title = ggplot2::element_text(colour = ag_highlight()))\nset_stocnet_theme(\"uzh\")\nau \u003c- autograph:::ggpizza(ag_qualitative(18)) + ggtitle(\"UZH\") + \n  theme(plot.title = ggplot2::element_text(colour = ag_highlight()))\nset_stocnet_theme(\"ethz\")\nae \u003c- autograph:::ggpizza(ag_qualitative()) + ggtitle(\"ETHZ\") + \n  theme(plot.title = ggplot2::element_text(colour = ag_highlight()))\nset_stocnet_theme(\"rug\")\nar \u003c- autograph:::ggpizza(ag_qualitative()) + ggtitle(\"RUG\") + \n  theme(plot.title = ggplot2::element_text(colour = ag_highlight()))\nset_stocnet_theme(\"iast\")\nas \u003c- autograph:::ggpizza(ag_qualitative()) + ggtitle(\"IAST\") + \n  theme(plot.title = ggplot2::element_text(colour = ag_highlight()))\nset_stocnet_theme(\"cmu\")\nac \u003c- autograph:::ggpizza(ag_qualitative()) + ggtitle(\"CMU\") + \n  theme(plot.title = ggplot2::element_text(colour = ag_highlight()))\nai | au | ae\nar | as | ac\n```\n\nIf your institution or organisation is not included and you would like it to be,\nplease just raise an issue on Github, \nalong with a link to your corporate branding or style guide if available,\nand we will attempt to add it at the next opportunity.\n\nIn sum, while there is a lot of clever defaults and customisation available,\nall it takes is three simple functions for your \n\n## Installation\n\n### Stable\n\nThe easiest way to install the latest stable version of `{autograph}` is via CRAN.\nSimply open the R console and enter:\n\n`install.packages('autograph')`\n\n`library(autograph)` will then load the package and make the data and tutorials (see below) contained within the package available.\n\n### Development\n\nFor the latest development version, \nfor slightly earlier access to new features or for testing,\nyou may wish to download and install the binaries from Github\nor install from source locally.\nThe latest binary releases for all major OSes -- Windows, Mac, and Linux -- \ncan be found [here](https://github.com/stocnet/autograph/releases/latest).\nDownload the appropriate binary for your operating system,\nand install using an adapted version of the following commands:\n\n- For Windows: `install.packages(\"~/Downloads/autograph_winOS.zip\", repos = NULL)`\n- For Mac: `install.packages(\"~/Downloads/autograph_macOS.tgz\", repos = NULL)`\n- For Unix: `install.packages(\"~/Downloads/autograph_linuxOS.tar.gz\", repos = NULL)`\n\nTo install from source the latest main version of `{autograph}` from Github, \nplease install the `{remotes}` package from CRAN and then:\n\n- For latest stable version: \n`remotes::install_github(\"stocnet/autograph\")`\n- For latest development version: \n`remotes::install_github(\"stocnet/autograph@develop\")`\n\n### Other sources\n\nThose using Mac computers may also install using Macports:\n\n`sudo port install R-autograph`\n\n## Funding details\n\nDevelopment on this package has been funded by the Swiss National Science Foundation (SNSF)\n[Grant Number 188976](https://data.snf.ch/grants/grant/188976): \n\"Power and Networks and the Rate of Change in Institutional Complexes\" (PANARCHIC).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/stocnet.github.io%2Fautograph%2F","html_url":"https://awesome.ecosyste.ms/projects/stocnet.github.io%2Fautograph%2F","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/stocnet.github.io%2Fautograph%2F/lists"}