ggraph_jk: Plot undirected graphs constructed from 2D data

Description Usage Arguments Examples

View source: R/ggraph_jk.R

Description

Plot undirected graphs constructed from 2D data

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
ggraph_jk(
  data = NULL,
  matrix_g = NULL,
  x = colnames(data)[1],
  y = colnames(data)[2],
  label = colnames(data)[3],
  colormap = NULL,
  color = "edge",
  plot_points = T,
  color_points = NULL,
  color_lines = NULL,
  cex_p = 3,
  size = 0.5,
  matlab = F
)

Arguments

data

The data to be displayed in this layer.

matrix_g

Matrix of edges in calculated graph. Could be a full matrix or sparse from the Matrix package.

x

Name of the first coordinate.

y

Name of the second coordinate.

label

Name of the column coresponding to ground truth in clustering. Could be omitted.

colormap

Colormap to color the vertices/edges of a graph.

color

A string indicating of what to color, using a colormap. Four options available: "none", "edge", "degree" and "wdegree". Degree uses colormap to color points based on the number of edges going to/from the given vertex. Wdegree calculates the sum of weights of edges in each vertex.

plot_points

boolean. Should we plot the vertices?

color_points

The chosen color for coloring points.

color_lines

The chosen color for coloring edges.

cex_p

Change the size of points.

size

Change the width of edges.

matlab

boolean. Should we use default MATLAB colors and try to replicate the ggplot theme?

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## Edge coloring
data(spiraly)
data(Wfull)
ggraph_jk(spiraly,Wfull)

ggraph_jk(spiraly,Wfull,colormap = colormap::colormap(colormap = "hot", n = 256),cex_p = 1.5)

## exporting graph and changing it
g <- ggraph_jk(data = spiraly, matrix_g = Wfull, color = "degree",cex_p = 3)
g + theme(legend.position = c(0.9,0.2),legend.background=element_blank())

##coloring nodes based on the sum of all weights of edges connected to them.
g <- ggraph_jk(data = spiraly, matrix_g = Wfull, color = "wdegree",cex_p = 3,matlab = T,color_lines = "black")
g + theme(legend.position = c(0.9,0.2),legend.background=element_blank())

ExabytE1337/Lori documentation built on Feb. 17, 2021, 1:18 a.m.