Questions tagged [ggraph]

ggraph is the "Grammar for Graph Graphics". At the time of writing, it is an actively maintained library for R that builds upon ggplot2 providing support for relational data structures such as networks, graphs and trees. It provides a concept of layouts to aid in the layout of a graph when visualising it.

Additional information, examples, documentation and the source can be obtained from GitHub - ggraph

209 questions
0
votes
1 answer

ggraph specify both fill and colour of nodes

I have seen examples of how to get node fill from the aesthetic and set the colour to have a black margin around the node. But if I try to specify a fixed color and fill I just get black…
0
votes
1 answer

Generating multiple network graphs with attributes from csv with ggraph, tidygraph in R

I have three csv files which looks like this: node <- data.frame( object = c("2-1887", "2-1887", "2-1887", "2-1887", "2-1887", "2-1887", "2-1887", "4-1889", "4-1889", "4-1889", "4-1889", "4-1889", "4-1889", "4-1889"), id = c(1, 2, 3, 4, 5, 6, 7, 1,…
HSJ
  • 687
  • 6
  • 16
0
votes
1 answer

On index attribute in ggraph

I’ m using ggraph to plot graphs based on hierarchical edge bundling. I’m using the example from https://www.r-graph-gallery.com/311-add-labels-to-hierarchical-edge-bundling.html. I have a question about the significance of index in the network…
user1988
  • 29
  • 1
  • 7
0
votes
1 answer

Defining a column as y-axis with tidygraph and ggraph? foodweb and network plots

community! I have a question regarding tidygraph:: and ggraph:: packages. I am trying to create a food web network plot (code and graph below), however, I wanted to use the kk layout with a defined y-axis, in my case the TL column from nodes_df. I…
Bia Dias
  • 23
  • 3
0
votes
1 answer

VisNetwork: How to color edges using HeatMap?

Let's have a data frame containing edges and their weights as follows. > data <- data.frame(From = sample(1:10,15,replace = T), + To = sample(1:10,15,replace = T), + Weight = runif(15,min = 0,max = 1)) > data …
0
votes
1 answer

How to go from a ggraph object to an igraph object? (R)

I would like create an interactive enrichment map. I have used the emapplot function from the enrichplot package to do this. But this function returns a static plot. I would like to make it interactive using (preferably) the visNetwork package. The…
lars22998
  • 1
  • 1
0
votes
0 answers

Network analysis: How to show the label of nodes?

I am trying to do a social network analysis of the activists on Twitter and I am having trouble to label the nodes or the communities in the network After I collected data, and transform the data to have a list of Twitter users. I then use the codes…
Qian
  • 37
  • 6
0
votes
0 answers

Force label repetitions for nodes in geom_node_text in ggraph

I am having some trouble forcing the labels I want in ggraph. I have a data frame for edges, another one for nodes that look like this: > edges # A tibble: 160 × 2 Elec1n Elec2n 1 1 45 2 1 44 3 1 42 …
Unai Vicente
  • 367
  • 3
  • 10
0
votes
2 answers

ggraph can't select columns for geom_node or geom_node_text aes variables

When I try using variables for geom_node_point or geom_node_text I keep getting errors, no matter what I do. Here's what I was trying at first. library(igraph) library(ggraph) library(tidyverse) graph3 <- graph_from_data_frame(test, directed =…
0
votes
1 answer

How to create ggraph reactive layout in shiny

so I've been working on this app looking at BC's drug checking data (see here), and I wanted to make my ggraph plots a bit more interactive, so that people could more readily see the connections between different nodes, by clicking over hovering…
0
votes
0 answers

How to set in order a secondary x-axis in ggraph / ggplot2?

I think I have lost my weekend dealing with this error for this I decided to post my code headache. I have this matrix library(tidyverse) library(tidygraph) library(ggraph) library(scales) mat <- matrix(c(10,10,0,2,5,0,1, 10,9,1,2,6,0,1, …
LDT
  • 2,856
  • 2
  • 15
  • 32
0
votes
1 answer

Specify node shape and label in a bipartite network with ggraph

I want to plot an adjacent matrix with ggraph. My data looks like this set.seed(43); check <- matrix(rnorm(10), nrow = 5,ncol = 4, dimnames = list(c("AL","CH","CZ","DN","SC"), c("GR","EN","GE","FR"))) GR EN GE …
LDT
  • 2,856
  • 2
  • 15
  • 32
0
votes
1 answer

Changing color in geom_node_point() from ggraph

I have a long dataframe with the following structure: FROM TO WEIGHT NAME_1 NAME_2 CATEGORY 1 2 0.1 name_1 name_2 category_a 2 3 0.3 name_2 name_3 category_b ... ... ... ... ... ... 195 33 0.2 name_195 name_33 category_a The idea…
ccfarre
  • 49
  • 1
  • 1
  • 5
0
votes
1 answer

Can I separate two groups of vertices in an arc plot in ggraph/ggplot2 in R?

I have gotten a great graph by two distinct electrodes with the following code: elec <- c("Fp1","Fp2","F7","F3","Fz","F4","F8","FC5","FC1","FC2","FC6","C3","Cz","C4","CP5","CP1","CP2","CP6","P7","P3","Pz","P4","P8","POz","Oz", …
Unai Vicente
  • 367
  • 3
  • 10
0
votes
0 answers

How to correctly plot arrows with ggraph

I want to plot a directed graph, where each edge width and arrow width is proportional to edge weights. I also want to display the weight of the edge on the graph. I am able to produce this graph with code library(ggraph) mydf <- structure(list(from…
shazz
  • 387
  • 1
  • 13