make_spiral_graph | R Documentation |
Turn an igraph object into a spiral graph returning a ggplot2 object.
make_spiral_graph(
g,
type = "Archimedean",
arcs = 6,
a = 1,
b = NULL,
rev = FALSE,
curvature = -0.6,
angle = 90,
markTimeBy = NULL,
labelSize = 3,
alphaV = 1,
alphaE = 0.6,
showArrows = FALSE,
title = "",
subtitle = "",
showEpochLegend = TRUE,
markEpochsBy = NULL,
epochColours = NULL,
epochLabel = "Epoch",
showSizeLegend = FALSE,
sizeLabel = "Size",
scaleVertexSize = c(1, 6),
vertexBorderColour = "black",
scaleEdgeSize = 1/5,
edgeColourLabel = "Weight",
showEdgeColourLegend = FALSE,
edgeColourByEpoch = TRUE,
defaultEdgeColour = "grey70",
doPlot = TRUE,
ggplotReturn = FALSE,
igraphReturn = FALSE
)
g |
An igraph object. If ( |
type |
Spiral type, one of |
arcs |
The number of arcs (half circles/ovals) that make up the spiral (default = |
a |
Parameter controlling the distance between spiral arms, however, the effect will vary for different spiral types (default = |
b |
Parameter controlling where the spiral originates. A value of 1 will generally place the origin in the center. The default |
rev |
If |
curvature |
The |
angle |
The |
markTimeBy |
Include a vector that indicates time. The time will be displayed on the plot. Pass |
labelSize |
The size of text in the annotation labels (default = |
alphaV |
Set transparency for Vertices (default = |
alphaE |
Set transparency for Edges. A single numeric, or a vector of length |
showArrows |
Show arrows at the end of the edges? (default = |
title |
A title for the plot |
subtitle |
A subtitle for the plot |
showEpochLegend |
Should a legend be shown for the epoch colours? (default = |
markEpochsBy |
A vector of length |
epochColours |
A vector of length |
epochLabel |
A title for the epoch legend (default = |
showSizeLegend |
Should a legend be shown for the size of the nodes? (default = |
sizeLabel |
Guide label, use it to indicate if |
scaleVertexSize |
Scale the size of the vertices by setting a range for |
vertexBorderColour |
Draw a border around the vertices. Pass |
scaleEdgeSize |
Scale the size of the edges by a constant: |
edgeColourLabel |
Use to indicate if |
showEdgeColourLegend |
Should a legend be shown for the colour of the edges? (default = |
edgeColourByEpoch |
Should edges that connect to the same epoch be assigned the epoch colour? This will ignore edge colour info in |
defaultEdgeColour |
Colour of edges that do not connect to the same epoch (default = |
doPlot |
Produce a plot? (default = |
ggplotReturn |
returns the ggplot object (default = |
igraphReturn |
returns the intermediate iGraph object. This will not look the same as the final graph, but has most of the attributes, like edge and vertex colors and spiral layout (default = |
A ggplot object.
To keep the igraph object, use the layout function layout_as_spiral()
when plotting the graph.
library(igraph)
g <- igraph::sample_gnp(200, 1/20)
V(g)$size <- degree(g)
make_spiral_graph(g, markTimeBy = TRUE, showSizeLegend = TRUE, sizeLabel = "Node degree")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.