python - Is it possible to plot iGraph plots on cygwin? -
while having no problems producing igraph
plots on ubuntu, following errors on cygwin:
$ python python 2.7.8 (default, jul 28 2014, 01:34:03) [gcc 4.8.3] on cygwin type "help", "copyright", "credits" or "license" more information. >>> igraph import graph, plot >>> >>> g = graph([(0,1), (0,2), (2,3), (3,4), (4,2), (2,5), (5,0), (6,3), (5,6)]) >>> g.vs["name"] = ["alice", "bob", "claire", "dennis", "esther", "frank", "george"] >>> >>> layout = g.layout("kk") >>> plot(g, layout = layout) traceback (most recent call last): file "<stdin>", line 1, in <module> file "/usr/lib/python2.7/site-packages/igraph/drawing/__init__.py", line 475, in plot result.show() file "/usr/lib/python2.7/site-packages/igraph/drawing/__init__.py", line 327, in show "on platform: %s" % plat) notimplementederror: showing plots not implemented on platform: cygwin_nt-6.1-wow >>>
did succeeded in producing igraph
plots on cygwin?
edit: documentation states:
plotting dependent on pycairo library provides python bindings popular cairo library. means if don't have pycairo installed, won't able use plotting capabilities.
i'll check if wrong py2cairo
install.
note other igraph
functionality works fine on cygwin:
$ python python 2.7.8 (default, jul 28 2014, 01:34:03) [gcc 4.8.3] on cygwin type "help", "copyright", "credits" or "license" more information. >>> igraph import graph, plot >>> g = graph() >>> print(g) igraph u--- 0 0 -- >>> g = graph([(0,1), (0,2), (2,3), (3,4), (4,2), (2,5), (5,0), (6,3), (5,6)]) >>> g.vs["name"] = ["alice", "bob", "claire", "dennis", "esther", "frank", "george"] >>> g.vs["age"] = [25, 31, 18, 47, 22, 23, 50] >>> g.vs["gender"] = ["f", "m", "f", "m", "f", "m", "m"] >>> g.es["is_formal"] = [false, false, true, true, true, false, true, false, false] >>> g.es[0]["is_formal"] = true >>> g.es[0] igraph.edge(<igraph.graph object @ 0xffcb542c>, 0, {'is_formal': true}) >>> g["date"] traceback (most recent call last): file "<stdin>", line 1, in <module> keyerror: 'attribute not exist' >>> g["date"] = "2015-05-31" >>> g["date"] '2015-05-31' >>> g.degree() [3, 1, 4, 3, 2, 3, 2] >>> g.edge_betweenness() [6.0, 6.0, 4.0, 2.0, 4.0, 3.0, 4.0, 3.0, 4.0] >>> g.vs[2].degree() 4 >>>
environment:
- windows 7
- cygwin cygwin_nt-6.1-wow ron 2.0.1(0.287/5/3)
- igraph 0.7.1
there's nothing wrong py2cairo
on machine, can test yourself. try plot(g, "test.png", layout=layout)
- save plot file instead of showing it. error message see thrown igraph because not able figure out how instruct operating system display png file (into plot saved) in window.
the command used show plots stored in configuration variable named apps.image_viewer
. can alter follows:
>>> igraph import configuration >>> cfg = configuration.instance() >>> cfg["apps.image_viewer"] = "start"
this trick start
command on windows supposed open default image viewer if pass name of png file it. if works, can persist changes writing following file pointed cfg.filename
:
[apps] image_viewer=start
for it's worth, part of igraph supposed figure out image viewer use on particular os (if apps.image_viewer
key not present) in igraph/configuration.py
in function named get_platform_image_viewer()
. function uses platform.system()
determine os using. if let me know platform.system()
prints in python, i'll submit patch makes igraph treat cygwin same way windows.
Comments
Post a Comment