roughnet {roughnet}R Documentation

Create a rough network

Description

plot a network using rough.js

Usage

roughnet(
  g,
  roughness = c(1, 1),
  bowing = c(1, 1),
  font = "30px Arial",
  width = NULL,
  height = NULL,
  elementId = NULL,
  chunk_name = "canvas"
)

Arguments

g

igraph object

roughness

numeric vector for roughness of vertices and edges

bowing

numeric vector for bowing of vertices and edges

font

font size and font family for labels

width

width

height

height

elementId

DOM id

chunk_name

markdown specific

Details

the function recognizes the following attributes Vertex attributes (e.g. V(g)$shape):

Edge attributes (e.g. E(g)$color):

Default values are used if one of the attributes is not found.

The result of a roughnet call can be printed to file with save_roughnet()

More details on roughjs can be found on https://github.com/rough-stuff/rough/wiki

Value

htmlwidget containing the drawn network

Examples

library(igraph)

g <- make_graph("Zachary")
V(g)$shape <- "circle"
V(g)$shape[c(1, 34)] <- "rectangle"
V(g)$fill <- c("#E41A1C", "#377EB8", "#4DAF4A", "#984EA3")[membership(cluster_louvain(g))]
V(g)$fillstyle <- c("hachure", "zigzag", "cross-hatch", "dots")[membership(cluster_louvain(g))]
V(g)$color <- "black"
V(g)$size <- 30
V(g)$stroke <- 2
E(g)$color <- "#AEAEAE"
roughnet(g, width = 960, height = 600)


[Package roughnet version 1.0.1 Index]