SachaEpskamp / qgraph

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

avoid opening a graphics device #28

Closed vandenman closed 5 years ago

vandenman commented 5 years ago

Hi Sacha,

For some reason, qgraph(...) always opens a graphics device in R if none are open. This doesn't really look necessary to me and it can kinda mess things up in JASP. So I made some small changes to avoid this whenever DoNotPlot = TRUE.

a minimal example:

data(big5)
data(big5groups)

# close all graphics devices
graphics.off() 
# get current device
dev.cur()
#null device 
#          1
big5Graph <- qgraph(cor(big5),minimum=0.25,groups=big5groups,
                            legend=TRUE,borders=FALSE, title = "Big 5 correlations", 
                            DoNotPlot = TRUE)

dev.cur()
# Current development verion of qgraph returns:
#RStudioGD 
#        2 
# This branch returns:
#null device 
#          1

I wasn't quite sure what loopRotation is needed for, but I'm sure you can judge that better.

Cheers, Don

SachaEpskamp commented 5 years ago

Thanks Don! What do you mean with loopRotation though?

vandenman commented 5 years ago

The changes at 2751-2754, for example:

  if (DoNotPlot)
  {
    loopRotation[is.na(loopRotation)] <- 0
  }
  else 
  # the same that happened before

I'm not sure what loopRotation is used for (I hoped you could tell me :P).

SachaEpskamp commented 5 years ago

loopRotation controls the orientation of self-loops (in radians). E.g., it can be used to place a self-loop below or above a node.