[R] igraph plot slowness

Loris Bennett loris.bennett at fu-berlin.de
Thu Aug 27 11:22:11 CEST 2015


Loris Bennett <loris.bennett at fu-berlin.de> writes:

> Hi Jim,
>
> jim holtman <jholtman at gmail.com> writes:
>
>> Here is what it does locally on my PC:
>>
>>> library("igraph")
>>>  topo_data <- read.table(text = "ibcore01        ibswitch01
>> +  ibcore01        ibswitch02
>> +  ibcore01        ibswitch03
>> +  ibcore02        ibswitch01
>> +  ibcore02        ibswitch02
>> +  ibcore02        ibswitch03
>> +  ibswitch01      node001
>> +  ibswitch01      node002
>> +  ibswitch01      node003
>> +  ibswitch02      node004
>> +  ibswitch02      node005
>> +  ibswitch02      node006
>> +  ibswitch03      node007
>> +  ibswitch03      node008
>> +  ibswitch03      node009" ,head=FALSE)
>>>  system.time({
>> +  network_data <-graph.data.frame(topo_data, directed=F)
>> +  plot(network_data)
>> + })
>>    user  system elapsed
>>    0.01    0.01    0.03
>>>
>>>
>>
>> Does not seem too slow.  Creating a PDF file takes a little longer:
>>
>>> library("igraph")
>>>  topo_data <- read.table(text = "ibcore01        ibswitch01
>> +  ibcore01        ibswitch02
>> +  ibcore01        ibswitch03
>> +  ibcore02        ibswitch01
>> +  ibcore02        ibswitch02
>> +  ibcore02        ibswitch03
>> +  ibswitch01      node001
>> +  ibswitch01      node002
>> +  ibswitch01      node003
>> +  ibswitch02      node004
>> +  ibswitch02      node005
>> +  ibswitch02      node006
>> +  ibswitch03      node007
>> +  ibswitch03      node008
>> +  ibswitch03      node009" ,head=FALSE)
>>>  system.time({
>> +  network_data <-graph.data.frame(topo_data, directed=F)
>> +  pdf('test.pdf')
>> +  plot(network_data)
>> +  dev.off()
>> + })
>>    user  system elapsed
>>    0.09    0.00    0.16
>>
>> The PDF file is attached.  So maybe it is something with your remote
>> connection.
>
> You're right.  Running locally even the plot of complete network takes
> less than 0.2 seconds via the X11 device.  I'll have a closer look at
> the connection.
>
> Thanks,
>
> Loris

I found the solution here:

http://www.r-bloggers.com/slow-r-graphics-via-ssh/

namely calling

X11.options(type="Xlib")

in the remote R session.

Cheers,

Loris

-- 
This signature is currently under construction.



More information about the R-help mailing list