Page MenuHomePhabricator

Create complete network plot in its function
Closed, ResolvedPublic

Description

Currently the network plot for cluster analysis is not completely set up in its function. It's is finally stitched together in the report.

Event Timeline

the function is network() and is already in the report

{r ,eval=T,fig.width=12, fig.height=6,include=FALSE}
if (length(relensemble)>2) {
  netw=network(object,
               method = "symdiff", 
               edge.col=grDevices::grey.colors,
               edge.lwd=1,
               rate=1.05,
               cols=cols
               )
  
  plot.new()
  leg=legend("topright",  names(netw$leg.col), lwd = 1, col = netw$leg.col, bg =NA,plot=F,cex=.8)
  w <- grconvertX(leg$rect$w, to='inches')
  addy=6+w
} else addy=1
{r network, fig.width=addy, fig.height=6,out.width='100%'}
if (length(relensemble)>2) {
  plot(netw,
       layoutType = "neato",
       fixedsize=TRUE,
       # fontsize,
       # width,
       # height,
       shape="ellipse",
       cex=.8
       )
}

the complication arises to handle the automatic sizing of the plot, which is why in the first chunk it reads out the width without plotting and in the second chunk the figure width is adapted

Is it not possible to create a plot first on a canvas that contains everything and as a second step add the scaled plot to the report?

this is more or less what I tried, ugliness is T27326. I think a ggplot solution mentioned there would be better

eisenman claimed this task.