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

how can I create identical result without using as_tbl_graph()?

My dataframe looks like this. Word1 Word2 Count -------------------------- a b 4 c a 2 b c 1 ------------------------- I want the following result. from to …
jjw
  • 481
  • 1
  • 4
  • 14
0
votes
1 answer

How to input tabular data and output circular packing plot?

Really confused about what input I should be using, I can't work it out from the example data set. I have a data set like this: node1 node2 edge_score x1 x2 0.1 x1 x3 0.2 x8 x4 0.1 x4 x5 0.4 x6 x7 …
Slowat_Kela
  • 1,377
  • 2
  • 22
  • 60
0
votes
1 answer

ggraph: Vertex position according to attribute

Suppose I have an igraph graph like the following: library(ggraph) library(igraph) vertices <- data.frame(name = LETTERS[1:6], time = c(0, 9, 9, 10, 10, 10)) edges <- data.frame(from = c("A", "B", "B", "A", "C", "C"), …
MSR
  • 2,731
  • 1
  • 14
  • 24
0
votes
1 answer

Undirected network graph calculated by tidygraph shows more degree centrality than should be possible

I have a cleaned data set with 26 nodes. I am placing these 26 nodes in an undirected network graph using tidygraph, where I use the centrality_degree() function to calculate the centrality degree. However, when I graph the resulting network, my…
kneijenhuijs
  • 1,189
  • 1
  • 12
  • 21
0
votes
1 answer

Ggraph node color to match edge color

Is it possible to get ggraph to plot node colors the same color as connected edge color? I've tried feeding ggraph the colors for edges and nodes manually without any luck. It seems as if this would be something rather trivial, but I can't find any…
elliot
  • 1,844
  • 16
  • 45
0
votes
0 answers

ggraph - Formatting graph edges

I'm trying to get a feel for the ggraph package by following this demonstration: https://www.r-bloggers.com/plotting-trees-from-random-forest-models-with-ggraph/. I would like to change the edge type to elbow and have tried replacing…
mkm
  • 11
  • 1
0
votes
1 answer

GGraph and formatting nodes

I would like to format the non leafs different, but I am unable to find more information on aes for the filter. What are the different possible values? Here is an example library(igraph) library(ggraph) gr <- graph_from_data_frame(flare$edges,…
xyx
  • 93
  • 2
  • 9
0
votes
0 answers

long and wide format equivalents in ggraph

I am trying to make graph similar to this: library(tidyverse) library(ggraph) iris_g <- den_to_igraph(as.dendrogram(hclust(dist(iris[1:4])))) xy_expand <- function(xy, expand) xy * (1 + expand / 10) ord <- match(as.numeric(V(iris_g)$label),…
gdkrmr
  • 674
  • 4
  • 16
0
votes
0 answers

Bigram network graph using tidy text mining [r | ggraph | igraph]

It is fixed now after following the comments. I'm following the tutorial given here - https://www.tidytextmining.com/ngrams.html. What I want to do is create a bigram network graph of review text present in a CSV file. Here is the link to the…
user709413
  • 505
  • 2
  • 7
  • 21
0
votes
1 answer

Overlaying subplot ggraph

I need to overlay a set of subplots over a ggraph. Every plot correspond to an especific node so they must be placed using the coordinates of every node. The following code creates the graph and the set of subplots to overlay. # Create the graph …
Ushuaia81
  • 495
  • 1
  • 6
  • 14
0
votes
0 answers

faceted network, unlinked vertices in ggraph

I'm puzzled about facetting a graph in R ggraph package library(tidyverse) library(ggraph) library(igraph) set.seed(100) yr=c(2013,2014,2015,2016) x=data.frame(from=LETTERS[sample(26,100,replace = T)], …
santoku
  • 3,297
  • 7
  • 48
  • 76
0
votes
2 answers

Retrieving node coordinates from ggraph network chart

Let's say I produce this chart: library(ggraph) library(igraph) my_chart <- graph_from_data_frame(highschool) set.seed(2017) ggraph(my_chart, layout = "nicely") + geom_edge_link() + geom_node_point() How would one retrieve the x and y…
Phil
  • 7,287
  • 3
  • 36
  • 66
-2
votes
1 answer

Is it possible to do a hierarchical diagram with a large dataset over 100?

I am trying to create a hierarchical graph (like a tree structure but ideally in a circle) that reflects a 3 way connection that goes from the individual sample to species to what label it falls under. Essentially emphasizing that all of these are…
IzOss
  • 25
  • 2
-3
votes
1 answer

Convert tidy dataframe to adjacency matrix

I have a dataframe of paper IDs and author names like so: library(tidyverse) df <- tribble( ~id, ~name, 1, "a", 1, "b", 2, "b", 2, "c", 3, "b", 3, "c" ) The interpretation is that authors a and b wrote paper 1 together, while…
user2987808
  • 1,387
  • 1
  • 12
  • 28
1 2 3
13
14