Questions tagged [ggnetwork]

Questions related to the `ggnetwork` R package.

The ggnetwork R package is used to visualize networks through the ggplot2 'grammar of graphics' syntax.

34 questions
3
votes
1 answer

remove unconnected nodes R igraph or ggnet

I have a symmetric matrix that represent degree of connections among actors. I would like to cancel out the vertex unconnected. The functions included in igraph (as delete_edges or delete_vertices) do not work for my case. I share my code #import of…
Leonardo
  • 71
  • 1
  • 1
  • 10
2
votes
1 answer

ggnetwork graph does not accurately plot values to colour nodes

I am trying to make a graph with ggplot2 and ggnetwork. I have a two dimensional lattice grid, an adjacency matrix, and I want to illustrate certain values by colour coding. Unfortunately i can either get the network going, or the accurate colour…
2
votes
0 answers

How to automatically adjust node and label size in ggnet2 (R)

I have a set of node/edge files to generate the network using ggnet2. I am facing two issues: Some might only have 5-10 nodes while others might have 1000-10000 nodes which makes the plot too crowd. So I am curious if there is any option to…
Mavershang
  • 1,266
  • 2
  • 15
  • 27
2
votes
0 answers

ggnetwork::geom_nodes() requires more colors than there are nodes

Load ggnetwork, network, sna, igraph, and ggplot: library(igraph) library(network) library(sna) library(ggnetwork) library(ggplot2) Create an igraph object with five vertices and two edges: test <- structure(list(5, TRUE, c(0, 3), c(4, 1), c(0,…
mkk
  • 879
  • 6
  • 19
2
votes
1 answer

Add jitterred points to a ggnetwork plot

I have a graph of vertices and edges which I'd like to plot using a fruchtermanreingold layout. Here's the graph edges matrix: edge.mat <-…
dan
  • 6,048
  • 10
  • 57
  • 125
2
votes
1 answer

Plot a tree-graph with ggplot

I have hierarchical data in this form: df <- data.frame(root=rep("unclustered",22), itr1=paste0("1.",c(1,5,1,2,4,1,3,2,5,5,6,9,4,3,4,8,5,7,3,2,10,8)), itr2=paste0("2.",c(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,10,17,18,19,20,21)), …
dan
  • 6,048
  • 10
  • 57
  • 125
2
votes
2 answers

Network Map Error: Each variable must be a 1d atomic vector or list

I am attempting to create a network map using various packages and methods. Using this as a guide, I have copied and pasted each step http://minimaxir.com/notebooks/interactive-network/ However, when I try to view plot it comes up with this…
MLMM
  • 85
  • 2
  • 8
1
vote
2 answers

Why this Network plot doesn't keep the nodes from same group together in R?

I have dataframe nodes with the group information like below: dput(nodes) structure(list(id = c("AC006329.1", "AC027796.4", "AC111170.2", "AC111170.3", "AC138207.4", "AP000695.2", "CDK15", "COL14A1", "COL15A1", "DDX11-AS1", "FOXP4-AS1",…
beginner
  • 1,059
  • 8
  • 23
1
vote
0 answers

How can I vizualize in a network or a map a matrix with count data from categorical variables?

I have a dataframe from an experiment with the stimuli on the columns and responses (in the form of one word) from participants in the rows. The dataframe is filled with counts of how many times that response was given for a stimulus. I looks like…
1
vote
1 answer

R ggnetwork node labels in plotly

I'm trying to plot a network (a protein-protein interaction graph as an R igraph object), which is moderately large in size (111 nodes with 929 edges), so I'm trying to find a reasonable way of labeling the nodes, which are either the protein IDs or…
user1701545
  • 5,706
  • 14
  • 49
  • 80
1
vote
0 answers

rbind (deparse level) error when plotting with ggnetwork

I have the following problem: When plotting a network with either ggnet2() or plot(), it works perfectly fine, but when I switch to ggnetwork(), I get the following error: Error in rbind(deparse.level, ...) : numbers of columns of arguments do not…
srrein
  • 23
  • 3
1
vote
1 answer

How to change the color of geom_node in ggnetwork?

I am trying to do a disease simulation, where I want the infected node(is_infected>0) to be red and the un-infected(is_infected=0) node color to be cyan. results <- results %>% mutate( S = infected == 0, …
harperzhu
  • 49
  • 7
1
vote
1 answer

Modify outwards label position in ggplot - avoid overlap between node and label

The outward position does almost what I want in my network (left labels to the left, right to the right). However I want to modify it slightly to avoid overlap with nodes. I try searching in the gtable (ggplot_build, ggplot_gtable) what to modify…
Ferroao
  • 3,042
  • 28
  • 53
1
vote
1 answer

Custom layout in ggnetwork

I have a network with a custom layout. I would like to customize it with ggnetwork (not shown, See vignette). I can pass the node positions to the ggnetwork (ggplot), but how to pass the arrow (edges) positions? Minimal…
Ferroao
  • 3,042
  • 28
  • 53
1
vote
1 answer

geom_nodelabel_repel() position for circular ggraph plot

I have a network diagram that looks like this: I made it using ggraph and added the labels using geom_nodelabel_repel() from ggnetwork: ( ggraph_plot <- ggraph(layout) + geom_edge_fan(aes(color = as.factor(responses), edge_width =…
1
2 3