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

R ggraph/ggplot2 color legend not displayed properly

I'm pretty new to ggraph and strugling a bit to get the legend to properly display the colors of the nodes. I have the following example data set: nodes <- data.frame( ID = c( 2, 3, 4, 5, 6, 7 ), cl = c( "A", "B", "A", "A",…
Gerald
  • 33
  • 4
3
votes
0 answers

R ggraph remove isolates when facet_edges specified

I am doing some exploratory network analysis with the tidygraph package. I am trying to produce a faceted plot with my data using ggraph package. I created 2 different tbl_graph objects, which I bound together using the bind_graphs function. The…
Filippo Santi
  • 109
  • 1
  • 8
3
votes
1 answer

selectively color/size nodes in ggraph

I'm using tidygraph and ggraph to plot a network. Is there a way to selectively manipulate nodes? Specifically, size and color, separately. # example data rstat_nodes <- data.frame(name = c("Hadley", "David", "Romain", "Julia")) rstat_edges…
ecology
  • 606
  • 3
  • 9
  • 29
3
votes
2 answers

Hide root node when faceting in ggraph with circlepack

I have a table of widgets; each widget has a unique ID, a color, and a category. I want to make a circlepack graph of this table in ggraph that facets on category, with the hierarchy category > color > widget ID: The problem is the root node. In…
A. S. K.
  • 2,504
  • 13
  • 22
3
votes
1 answer

ggraph - increase node size based on frequency

Been reading Tidytext Mining with R by Julia Silge and David Robinson - https://www.tidytextmining.com/nasa.html - and stumped on how to have the node size adjust in relation to frequency (n). Tried the following code... library(widyr) …
Atwp67
  • 307
  • 5
  • 21
3
votes
1 answer

Problems with the ggraph installation

I have some problems to install ggraph, I tried different ways like: How to install GGRAPH package to the latest R (v.3.3.2) or R on OSX: ggraph install error. I already installed the packages igraph and ggforce But the installation wasn't…
2
votes
1 answer

Customized legend for ggraph

I want to create a customised legend. Example legend is shown below This is my plot I created this plot using ggraph. Under this plot or somewhere near the plot I want to have the legend which I mentioned above? Any Ideas
People
  • 63
  • 5
2
votes
1 answer

How to use subscript with ggraph in R?

Simple enough question that seems to be taking a lot of time to solve. When creating a dendrogram using ggraph, I'm trying to include a subscript in the node labels. However, I can't seem to get it to work using expression. For example, if I create…
Electrino
  • 2,636
  • 3
  • 18
  • 40
2
votes
1 answer

Colouring nodes using graph and tidygraph in R?

I recently asked this question about how to colour nodes by variable. And the code works great. However, I'm back trying to colour the terminal nodes separately. For example, if I create some data, then turn them into tidygraph objects and plot them…
Electrino
  • 2,636
  • 3
  • 18
  • 40
2
votes
1 answer

R - How to modify the legend?

I'd like to modify the legend in my plot (see below) by adjusting the number of columns (e.g. from one column with nine rows to three columns and three rows). I already tried to add guides(alpha = guide_legend(ncol = 3)) to adjust the number of…
mri
  • 442
  • 2
  • 13
2
votes
1 answer

Setting offset and dodging in a circular hierarchical dendrogram

I have been trying to create a dendrogram with hierarchical edge bundling using the ggraph package, and have run into 2 major issues. Questions and code are revised slightly for clarity Firstly, the graph seems to always start from arbitrary points…
Arshiya
  • 93
  • 9
2
votes
2 answers

ggraph use fill and color in geom_node_point

I'm trying to make a sample ego network plot, but coloring the nodes using "fill" isn't working for me. This may be a trivial issue, but I can't figure out the problem. This is my…
L. Tucker
  • 523
  • 2
  • 12
2
votes
1 answer

Remove isolated nodes from dynamic layout in ggraph plot

I have a friendship network dataset over several waves. I want to plot the friendships that persist over the waves, and keep the nodes in the same coordinates for each plot. I'm able to use ggraph and graphlayouts' dynamic layout to keep the nodes…
L. Tucker
  • 523
  • 2
  • 12
2
votes
1 answer

geom_node_image() - Images for nodes in ggraph

I am trying to use images (e.g. country flags) in a ggraph network. I was looking to use ggimage's geom_image, however I reckon that the function needs to be adapted to work with ggraph where we do not specify the x and y…
Martin
  • 1,141
  • 14
  • 24
2
votes
1 answer

Can't get ggraph to display labels for a dendrogram

I use ggraph to visualise the results from a cluster analysis. But I can't get ggraph to display labels. I tried adding them as row names to the data, and I tried adding them as a vector to labels – to no avail. I'm very new to ggraph: Any help or…
John
  • 109
  • 1
  • 8
1 2
3
13 14