ggnetwork icon indicating copy to clipboard operation
ggnetwork copied to clipboard

ggplot(n) returns blank plot

Open Fred-White94 opened this issue 3 years ago • 1 comments

As the title describes. I cannot get the ggplot method to plot my own network or even the network from the tutorial. The network is created and can be visualised (not so nicely) with plot(n) but ggplot(n) returns a blank plot.

library(ggplot2)
library(network)
library(sna)
library(ggnetwork)
n <- network(rgraph(10, tprob = 0.2), directed = FALSE)

n %v% "family" <- sample(letters[1:3], 10, replace = TRUE)
n %v% "importance" <- sample(1:3, 10, replace = TRUE)

e <- network.edgecount(n)
set.edge.attribute(n, "type", sample(letters[24:26], e, replace = TRUE))
set.edge.attribute(n, "day", sample(1:3, e, replace = TRUE))

theme_blank

ggnetwork(n, layout = "fruchtermanreingold", cell.jitter = 0.75)
ggnetwork(n, layout = "target", niter = 100)

ggplot(n)

Fred-White94 avatar Feb 04 '22 08:02 Fred-White94