summaryrefslogtreecommitdiff
path: root/man/networkplot.Rd
blob: c0a0a3e64f31fcab728c43a570936ce99db2952b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/networkplot.R
\name{networkplot}
\alias{networkplot}
\title{Network Plot}
\usage{
networkplot(
  R,
  groups = NULL,
  group_label = NULL,
  title = NULL,
  r_label = "Correlation"
)
}
\arguments{
\item{R}{A square numeric matrix with names columns and rows}

\item{groups}{Optional data.frame mapping nodes to groups}

\item{group_label}{Optional string labeling the kind of grouping}

\item{title}{Optional plot title}

\item{r_label}{The string naming the relationship type (default 'Correlation')}
}
\value{
A ggraph object
}
\description{
Draw an undirected graph from a square matrix
where each variable is a node and the pairwise
entries are the strength of the relationship
(ex: correlation, partial correlation).
Based on https://r-graph-gallery.com/310-custom-hierarchical-edge-bundling.html
}
\examples{
X <- matrix(data = rnorm(100), nrow = 10)
R <- cor(X)
networkplot(R, title = 'Example Correlation Plot')
colnames(R) <- as.character(seq_len(ncol(R)))
g <- data.frame(
node = colnames(R),
group = rep(c('A', 'B'), length.out = ncol(R))
)
networkplot(R, groups = g, title = 'Example Correlation Plot')

}