SachaEpskamp / qgraph

Developmental version of qgraph
GNU General Public License v2.0
68 stars 21 forks source link

Stacking multiple qgraphs into the same plot #60

Closed raphael-lorenzdelaigue closed 2 years ago

raphael-lorenzdelaigue commented 2 years ago

Hello,

packages such as the patchwork package allow for representation of multiple ggplots in the same layout.

Is there a way to stack "qgraph" objects, such as obtained when plotting the output of the estimateNetwork function from the bootnet package?

If yes, I haven't found it yet.

Maybe there is a way to convert "qgraph" objects to a "ggplot" object?

There seems to be a post on StackOverflow with a similar request.

SachaEpskamp commented 2 years ago

Hi!

qgraph creates base R plots, so you can just use base R solutions for this. I always use the layout function myself.

Best, Sacha

raphael-lorenzdelaigue commented 2 years ago

I might be expressing luxury tastes here, but if I understand correctly - there is no way to convert a plot as created by qgraph, to a ggplot?

It could make some of my code more consistent, for example, if I have other ggplots in my analysis (created by myself or other packages), and don't have to "sometimes use base R graphics code, sometimes use ggplot code, depending on the plot".

SachaEpskamp commented 2 years ago

Base R graphics and ggplot2 graphics (which are grid based) are entirely different things. You can't transform one type to the other. The qgraph package is base R based. There are some packages that allow for ggplot2 based network plots, but they won't have all the automatizations and features the qgraph package has. I believe EGAnet now uses a ggplot2 like plotting feature for example.

raphael-lorenzdelaigue commented 2 years ago

Thanks!