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
2
votes
1 answer

R : how to control behaviour of edges in ggraph

I'm facing this issue: I got some data like these: library(tidyverse) library(tidygraph) library(ggraph) library(ggrepel) edges <- data.frame(a=c('k','k','k','k','k','z','z'), b=c('b','b','b','b','c','b','c'), costant = 1) a b…
s__
  • 9,270
  • 3
  • 27
  • 45
2
votes
1 answer

R: error with ggplot2 in loading ggraph

I'd like to use ggraph package, but loading it, I got this error: library(ggraph) Error: package or namespace load failed for ‘ggraph’: object ‘scale_type’ is not exported by 'namespace:ggplot2' What does it mean? How can I fix it? I'm not finding…
s__
  • 9,270
  • 3
  • 27
  • 45
2
votes
1 answer

Plotting a tree hierarchy using ggraph

I have the following tree hierarchy data.frame: hierarchy.df <- data.frame(raw=rep("Unclustered",26), cluster.itr1="1.1,1.1,1.3,1.2,1.2,1.1,1.3,1.2,1.3,1.3,1.6,1.3,1.2,1.4,1.3,1.3,1.3,1.2,1.1,1.3,1.2,1.3,1.3,1.6,1.4,1.5", …
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
1 answer

3D pipe/tube plots in R - creating plots of tree roots

I'm trying to create 3D plots of simulated tree roots in R. Here is an example of a root system growing over time: This is essentially a 3D network of cylinders, where the cylinder diameter (and, optionally, color) represents the size of the root.…
Kevin
  • 491
  • 3
  • 10
2
votes
1 answer

linear graph with specific scale for nodes in ggraph R

I'm experimenting with the outstanding ggraph library to depict some really-hard to depict interrelationships for a scientific work. Specifically, I want to show SNP-SNP interactions in a genetic locus. It would be very nice if I plotted the…
RobW
  • 125
  • 7
2
votes
1 answer

How to hide unconnected nodes in ggraph

Given the following example code, library(tidyverse) library(tidygraph) library(ggraph) reprex <- tibble(to = 1:10, from = c(2:10, 1), facet = rep(1:2, each = 5)) %>% as_tbl_graph() reprex_plot <- reprex…
martijn
  • 43
  • 7
2
votes
1 answer

Adding word count size as a layer to the node size on a cooccurrence network chart using tidytext

I'm interested in using a similar co-occurrence network chart as what is shown on section 8.2.2 David Robinson and Julia Silge's Tidy Text mining book, such as this chart, except that I would like to have the sizes of the nodes change depending on…
Phil
  • 7,287
  • 3
  • 36
  • 66
2
votes
1 answer

"Object 'direction' not found" with dendrogram in ggraph package

I try to plot a dendrogram with the ggraph package but, it's ok with geom_edge_diagonal() but not with geom_edge_elbow() Packages library(phyloseq) library(igraph) library(ggraph) Getting data The file ps.rds is available…
abichat
  • 2,317
  • 2
  • 21
  • 39
2
votes
1 answer

Plot a graph with spatial coordinates lat long using ggraph

I have a graph created with igraph where each node has a spatial location with lat and long. I would like to use ggraph to plot this network using these spatial coordinates to define the position/layout of nodes. Any ideas on how to do this? I know…
rafa.pereira
  • 13,251
  • 6
  • 71
  • 109
2
votes
3 answers

ggraph network plot: specify node coordinates

Trying to plot a network with the ggraph package and specify the coordinates of each node. While I can implement this with the igraph package - I cannot do this with the ggraph package. # reproducible example to generate a random…
Cela_101
  • 31
  • 1
  • 5
1
vote
1 answer

How can I set specific colors in ggraph links according to a treshold value?

I need some help with a network I'm trying to plot with ggraph. I want that the edges color depend on the value of the weight in my edges data frame. I've tried the code below (among others) with no result. Anyone familiar with this subject? Thank…
1
vote
0 answers

how can I specify the hover options for a segment in ggiraph?

I'm trying to make a workaround with ggiraph to create an interactive network with ggraph. What I want is to be able to highlight the edges upon hovering and display some info. I created a sample graph and managed to get the interactive part for the…
1
vote
0 answers

How to plot this network graph with nodes in a circle and labels outside the nodes in R?

I need to plot a gene network graph like this. I tried igraph package and the labels are on the nodes. Any idea how to plot this? Or should I use other packages instead? This is my R code obj.graph <- graph_from_adjacency_matrix(Omega, mode =…
Hepdrey
  • 11
  • 3
1
vote
1 answer

Map coordinates of connections with to and from vertices names

I am trying to figure out a way to map coordinates generated through geom_conn_bundle with the vertices name of the graph. Following is the sample data and my implementation: d1 <- data.frame(from="origin", to=paste("Dept", seq(1,5), sep="")) d1 <-…
SAL
  • 597
  • 3
  • 17