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
14
votes
2 answers

Get subgraph of shortest path between n nodes

I have an unweighted graph and I want to get a subgraph that has just the nodes and edges that contain the shortest paths between n known nodes. In this case 3 nodes (11, 29, & 13 are the names). Question How can I get a subgraph of shortest path…
Tyler Rinker
  • 108,132
  • 65
  • 322
  • 519
9
votes
1 answer

How to have "a" removed from a ggraph plot legend?

Can the letter "a" be removed from the legend associated with e.g. a fill or colour aesthetic, in a ggraph network plot, like in the simple example below ? library(igraph) library(ggraph) g1 <- make_ring(6) vertex_attr(g1) <- list(name =…
8
votes
1 answer

Repel text from edges in network

When drawing a network, it would be nice if the labels of the nodes could also avoid network edges. E.g. in the example below, it would be possible to move all the labels outside the network. I've tried several packages, but so far have not found…
puslet88
  • 1,288
  • 15
  • 25
6
votes
2 answers

How to control node color in ggraph?

I have a network graph, and I would like to color the edges to match their respective nodes. This is rather straight forward in an igraph plot, but I'd prefer to do in ggraph as I like the other aesthetics offered by the package. There seems to be…
elliot
  • 1,844
  • 16
  • 45
6
votes
0 answers

Manual legend in ggraph/ggplot2 [R]

Apart from this post, here I am asking new questions how to make adjustment in legends built by ggraph. Here are scripts to produce current plot: ## Packages library(igraph) library(tidygraph) library(ggraph) library(ggplot2) …
HSJ
  • 687
  • 6
  • 16
6
votes
1 answer

Problems using lat/long data for a layout in ggraph

I am trying to figure how to use a lat/long layout in ggraph but can't seem to work my way through the syntax. Consider this reprex with some data modified from the iris dataset: data <- structure(list(Sepal.Length = c(5.1, 4.9, 4.7, 4.6, 5, 5.4,…
boshek
  • 4,100
  • 1
  • 31
  • 55
5
votes
1 answer

making a data.frame igraph compatible by creating edgelist from location data

I am currently working on a project visualizing a network of think tank board members and their respective boards. The data I have is in the following format: name edge 1 A 1 2 A 2 3 A 3 4 B 4 5 B 5 6 C …
5
votes
1 answer

Convert ggraph to interative plot with plotyly or Network3D

I was looking for an example or tutorial to convert a ggraph object to an iterative force network. First I tried to convert to plotly object using plotly::ggplotly function. But seems the plotly don't deal nicely with this kind of conversion and…
Aureliano Guedes
  • 767
  • 6
  • 22
5
votes
1 answer

Legend line thickness in ggraph

When using ggraph, is there a way to thicken the legend lines for edge color? I'm trying to override but to no avail. Here's an example: library(tidyverse) library(igraph) library(ggraph) set.seed(20190607) #create dummy data Nodes <-…
Jordo82
  • 796
  • 4
  • 14
5
votes
0 answers

Remove unused nodes in ggraph

I have the following data.frame. library(tidyverse) library(ggraph) library(tidygraph) df <- structure(list(from = c(3L, 3L, 1L, 1L, 1L, 3L, 3L, 3L, 3L, 2L, 2L, 1L, 3L, 1L, 3L, 3L, 3L, 1L, 3L, 3L, 2L, 3L, 3L, 2L, 3L, 3L, 1L, 3L, 1L, 1L, 2L, 1L,…
elliot
  • 1,844
  • 16
  • 45
5
votes
0 answers

geom_edge_link() in ggraph won't let me specify edge colour

a bit of a mystery to me here. I'm simply trying to change the edge colour of a graph using ggraph, and the edges go orange no matter what colour I use. for example, here I attempt to set the edge_colour to grey: library(igraph) library(ggraph) ring…
5
votes
1 answer

How to install GGRAPH package to the latest R (v.3.3.2)

I am very new to R and I need ggraph library and it can't be installed from rstudio console. Here is a message: Warning in install.packages : package ‘ggraph’ is not available (for R version 3.3.2) Are there other ways of installation? Looks…
Andrew Anderson
  • 1,044
  • 3
  • 17
  • 26
4
votes
1 answer

Network Diagram with Date Axis

I want to create a directed network visualization with the X-Axis fixed in time. Assuming I have the following…
eitanlees
  • 1,244
  • 10
  • 14
4
votes
1 answer

ggraph make filled arrow edges appear in legend

I'm trying to make a genealogy diagram of the history of EDA, coloring the edges and arrows by the Institution of the PhD degree. This sort of works, but the filled arrow heads in the diagram appear unfilled in the legend. Is there some way to get…
user101089
  • 3,756
  • 1
  • 26
  • 53
4
votes
1 answer

Is it possible to resize the relative node size in ggrraph?

New to R; did my best with the rendering my question with the help of with reprex. I have a network with nodes sized by degree, using the ggraph package. The plotted network doesn't look great because some of the nodes are quite small. I would like…
avgoustisw
  • 213
  • 1
  • 7
1
2 3
13 14