About the package
This package aims to make exploration, analysis, and publication of results from any of the stocnet packages easier, faster, and more consistent. It does this by letting you simply set a theme, say for your institution, and then those palettes will be used whenever you use plot()
or graphr()
on an object created in one of the relevant packages.
Setting a theme
It is very easy to set a theme. Just type stocnet_theme()
to see which is the theme currently set, and to get a list of available themes. Then enter the chosen theme name in the function to set it. All plots created using autograph functions will then use this theme, until you change it again.
library(autograph)
library(patchwork)
stocnet_theme()
#> ℹ Theme is set to default.
#> ℹ The following themes are available: default, bw, iheid, ethz, uzh, rug, unibe, crisp, neon, and rainbow.
(plot(node_degree(ison_karateka)) +
plot(tie_betweenness(ison_karateka)))/
(plot(node_in_regular(ison_southern_women, "e")) +
plot(as_matrix(ison_southern_women),
membership = node_in_regular(ison_southern_women, "e")))
stocnet_theme("ethz")
#> ✔ Theme set to ethz.
(plot(node_degree(ison_karateka)) +
plot(tie_betweenness(ison_karateka)))/
(plot(node_in_regular(ison_southern_women, "e")) +
plot(as_matrix(ison_southern_women),
membership = node_in_regular(ison_southern_women, "e")))
Mapping
autograph includes three one-line graphing functions with sensible defaults based on the network’s properties.
graphr
First, graphr()
is used to graph networks in any of the manynet formats. It includes sensible defaults so that researchers can view their network’s structure or distribution quickly with a minimum of fuss. Compare the output from autograph with a similar default from igraph:
Here the autograph function recognises that the network is a two-mode network and uses a bipartite layout by default, and recognises that the network contains names for the nodes and prints them vertically so that they are legible in this layout. Other ‘clever’ features include automatic node sizing and more. By contrast, igraph requires the bipartite layout to be specified, has cumbersome node size defaults for all but the smallest graphs, and labels also very often need resizing and adjustment to avoid overlap. All of autograph’s adjustments can be overridden, however…
More options
Changing the size and colors of nodes and ties is as easy as specifying the function’s relevant argument with a replacement, or indicating from which attribute it should inherit this information.
More layouts
autograph can use all the layout algorithms offered by packages such as igraph, ggraph, and graphlayouts, and offers some additional layout algorithms for snapping layouts to a grid, visualising partitions horizontally, vertically, or concentrically, or conforming to configurational coordinates.
Installation
Stable
The easiest way to install the latest stable version of autograph is via CRAN. Simply open the R console and enter:
install.packages('autograph')
library(autograph)
will then load the package and make the data and tutorials (see below) contained within the package available.
Development
For the latest development version, for slightly earlier access to new features or for testing, you may wish to download and install the binaries from Github or install from source locally. The latest binary releases for all major OSes – Windows, Mac, and Linux – can be found here. Download the appropriate binary for your operating system, and install using an adapted version of the following commands:
- For Windows:
install.packages("~/Downloads/autograph_winOS.zip", repos = NULL)
- For Mac:
install.packages("~/Downloads/autograph_macOS.tgz", repos = NULL)
- For Unix:
install.packages("~/Downloads/autograph_linuxOS.tar.gz", repos = NULL)
To install from source the latest main version of autograph from Github, please install the remotes package from CRAN and then:
- For latest stable version:
remotes::install_github("stocnet/autograph")
- For latest development version:
remotes::install_github("stocnet/autograph@develop")
Funding details
Development on this package has been funded by the Swiss National Science Foundation (SNSF) Grant Number 188976: “Power and Networks and the Rate of Change in Institutional Complexes” (PANARCHIC).