igraph-help
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [igraph] plot() in python-igraph not giving graphic


From: Tamás Nepusz
Subject: Re: [igraph] plot() in python-igraph not giving graphic
Date: Mon, 23 Jun 2014 12:04:20 +0200

Hi,

plot(g) should show the visualization as well - if it doesn't, it typically means that it cannot find a suitable image viewer on your system. The built-in detection mechanism is a bit "dumb" as it only tries to find one of those executables in your system path:

eog, gthumb, gqview, kuickshow, xnview, display, gpicview, gwenview, qiv, gimv

If neither of these is found, no plot will be shown. So, either you should install one of the above image viewers, or configure the one that you use in ~/.igraphrc by entering the following:

[apps]
image_viewer=/usr/bin/your-image-viewer

Also, if you happen to use a standard Linux image viewer that igraph does not know about yet, let me know and I'll add it to the list of executables that igraph looks for.

As another workaround, you can ask igraph to plot the graph into a PDF or PNG file as well:

plot(g, "whatever.pdf")

All the best,
-- 
T.

From: Stuti Rastogi address@hidden
Reply: Help for igraph users address@hidden
Date: 23 June 2014 at 08:08:27
To: address@hidden address@hidden
Subject:  [igraph] plot() in python-igraph not giving graphic

Hello,

I am struggling with the plot() function in python-igraph on Ubuntu 12.04. I wish to get a graph like the one attached with the plot function (this has been created by igraph plot itself so I know it can be done).

I have installed igraph 0.7 and also PyCairo

address@hidden:~$ sudo apt-get install python-cairo
Reading package lists... Done
Building dependency tree      
Reading state information... Done
python-cairo is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.


In the ipython shell:

In [1]: import igraph, cairo

In [2]: from igraph, cairo import *
  File "<ipython-input-2-f56545cfa77e>", line 1
    from igraph, cairo import *
               ^
SyntaxError: invalid syntax


In [3]: from igraph import *

In [4]: from cairo import *

In [5]: g = Graph([(0,1), (1,2), (0,2)])

In [6]: summary(g)
IGRAPH U--- 3 3 --

In [7]: plot(g)
Out[7]: <igraph.drawing.Plot at 0xb56a014c>

In [8]:



So here, I can see that a Plot object has been created but how do I view it? Shouldn't it give a graphic visualisation as well?

Please help me, as this part is crucial for my project and I have been struggling a while.

Thanks in advance.

--
Regards,
Stuti Rastogi
_______________________________________________
igraph-help mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/igraph-help

reply via email to

[Prev in Thread] Current Thread [Next in Thread]