graph.plot: graph.plot - Plots a weighted graph, with weighted edges as a...

View source: R/plots.R

graph.plotR Documentation

graph.plot - Plots a weighted graph, with weighted edges as a default

Description

graph.plot - Plots a weighted graph, with weighted edges as a default

Usage

graph.plot(
  graph,
  layout = layout_with_fr(graph, weight = E(graph)$weight^2, grid = "nogrid"),
  vertex.color = "black",
  vertex.fill = "grey60",
  vertex.shape = 21,
  vertex.size = 3,
  vertex.alpha = 1,
  vertex.stroke = 0.5,
  vertex.order = FALSE,
  vertex.background = "white",
  edges = TRUE,
  edge.color = "darkblue",
  edge.alpha = E(graph)$weight,
  edge.size = 1,
  edge.line = "solid",
  edge.order = FALSE,
  text = FALSE,
  text.background = NULL,
  text.background.alpha = 0.4,
  text.background.border = 0,
  text.size = 3,
  text.color = "black",
  text.alpha = 1,
  legend = "side",
  text.vjust = 1.5,
  text.family = "Times",
  midpoints = FALSE,
  midpoint.arrow = arrow(angle = 20, length = unit(0.33, "cm"), ends = "last", type =
    "closed"),
  edge.text = FALSE,
  edge.text.size = 3,
  edge.text.alpha = 0.9,
  norm.coords = TRUE
)

Arguments

graph

a igraph network object

layout

a two-column numerical matrix with coordinates for each vertex of graph

vertex.color

a single value or a vector of the same length and order as the vertices in graph. See colors for valid single values.

vertex.fill

a single value or a vector of the same length and order as the vertices in graph. See colors for valid single values.

vertex.shape

a single value or a vector of the same length and order as the vertices in graph.

vertex.size

a single value or a vector of the same length and order as the vertices in graph.

vertex.alpha

a single value between 0 and 1 or a vector of the same length and order as the vertices in graph.

vertex.stroke

a single numeric value controlling the stroke size of points

vertex.order

a numeric vector of the same length and order as the vertices in the graph.

edges

if TRUE edges are drawn.

edge.color

a single value or a vector of the same length and order as the edges in graph. See colors for valid single values.

edge.alpha

a single value between 0 and 1 or a vector of the same length and order as the edges in graph.

edge.size

a single value or a vector of the same length and order as the edges in graph.

edge.line

a single value or a vector of the same length and order as the edges in graph.

edge.order

a vector of the same length and order as the edges in graph. Edges are drawn in increasing order, with the highest overlapping those at a lower order.#' @param text

text.size

if TRUE vertex names are drawn.

text.color

a single value or a vector of the same length and order as the vertices in graph. See colors for valid single values.

text.alpha

a single value or a vector of the same length and order as the vertices in graph.

legend

sets the position of the legend. "side" places the legend on the right hand side and "bottom" places the legend along the bottom of the plot.

text.vjust

a number setting the amount of vertical adjustment of the position of the text

midpoints

if TRUE edges have a arrow at their middle showing the direction of the edge. This naturally only applies to directed networks.

midpoint.arrow

sets the character of the midpoint arrow, see arrow

edge.text

if not FALSE, then a vector with the labels for each edge.

edge.text.size

a single value or a vector of the same length and order as the edges in graph.

edge.text.alpha

a single value or a vector of the same length and order as the edges in graph.

norm.coords

if TRUE layout coordinates are normalized

Value

a ggplot2 plot

Examples

data(den)
health.affil  <- has.tags(den, c("Health"))
den.health    <- droplevels(den[den$AFFILIATION %in% health.affil,])
net.org       <- elite.network(den.health, result = "affil")
lay.org       <- layout.fruchterman.reingold(net.org)
p             <- graph.plot(net.org, layout = lay.org, vertex.size = V(net.org)$members, vertex.fill = degree(net.org),
                            edge.color = "darkmagenta", edge.alpha = log(1/E(net.org)$weight))
p             <- p + scale_fill_continuous(low = "white", high = "magenta") + scale_size_continuous(range = c(3, 10))
p + scale_alpha_continuous(range = c(0,1))

antongrau/eliter documentation built on March 2, 2024, 8:05 p.m.