Closed Rhydderch closed 1 year ago
This is hard to do in a single qgraph
call because the suplot fills the entire node, but you can just make one plot for the pie charts and plot the subplots on top with an empty network and smaller node sizes:
# Weights matrix:
mat <- matrix(rnorm(5^2),5,5)
# Suplots:
sp <- list(
expression(plot(rnorm(100),rnorm(100),xlab="",ylab="",axes=FALSE)),
expression(plot(rnorm(100),rnorm(100),xlab="",ylab="",axes=FALSE)),
expression(plot(rnorm(100),rnorm(100),xlab="",ylab="",axes=FALSE)),
expression(plot(rnorm(100),rnorm(100),xlab="",ylab="",axes=FALSE)),
expression(plot(rnorm(100),rnorm(100),xlab="",ylab="",axes=FALSE))
)
# Plot the network with pie charts:
Q <- qgraph(mat,
pie=runif(5),
vsize = 10,
shape = "square",
labels=FALSE
)
# Plot the subplots:
qgraph(matrix(0,5,5),
vsize = 9,
shape = "square",
labels=FALSE,
plot=FALSE,
layout = Q$layout,
subplots = sp
)
Thanks a lot! It worked.
Dear Sacha,
Qgraph is really a godsend, and I'm enjoying pushing its limits. It's great to show a lot of information at once.
I realized I am not able to subplots combined with the "pie" function.
the following code shows the pie border:
However, if I uncomment the "subplots" arguments, this is the result:
Would there be a way to use both together?