2

I have defined the following simple graph using the python's igraph package:

from igraph import *

g = Graph()
g.add_vertices(3)
g.add_edges([(1,0),(0,2),(1,2)])
plot(g)

According to the tutorial on igraph, the plot(g) command must

"... open an external image viewer showing a visual representation of the network ... ".

However, the plot(g) command gives an error while I execute the program, that is as follows.

Pavithrans-MacBook-Pro:LDPC pavithran$ python simplePlot.py
Traceback (most recent call last):
  File "simplePlot.py", line 6, in <module>
    plot(g)
  File "/Library/Python/2.7/site-packages/igraph/drawing/__init__.py", line 458, in plot
    result = Plot(target, bbox, background="white")
  File "/Library/Python/2.7/site-packages/igraph/drawing/__init__.py", line 129, in __init__
    self._surface_was_created = not isinstance(target, cairo.Surface)
  File "/Library/Python/2.7/site-packages/igraph/drawing/utils.py", line 396, in __getattr__
    raise TypeError("plotting not available")
TypeError: plotting not available

I am unable to understand where the error is and what exactly I must install in order to account for this error. I have installed Cairo’s Python bindings, XCode and (of course) the igraph package.

I will be very thankful if anyone can suggest me what I must do.

Pavithran Iyer
  • 402
  • 5
  • 14
  • 2
    Can you confirm that Cairo's Python bindings are installed correctly? What does the Python interpreter say when you type `python -c 'import cairo'`? I'm asking this because igraph simply tries to import the `cairo` module in exactly the same way and responds with the `plotting not available` exception if the module cannot be imported. – Tamás Aug 29 '14 at 20:25
  • 1
    see here : [link](https://stackoverflow.com/questions/34251426/python-igraph-unable-to-plot) – seralouk Jun 14 '17 at 13:18

0 Answers0