igraph-help
[Top][All Lists]

[igraph] how to plot degree distribution, please?

 From: ???????????? Subject: [igraph] how to plot degree distribution, please? Date: Sun, 18 Sep 2016 00:25:28 +0800

Hi everyone,

It seems the maillist works to me again.

so my question is:

how to plot the degree distribution when i get it by dd = g.degree_distribution() in python?

I can print it, but when I use the function __plot__, I got error as follows. How to plot it please?

dd = g.degree_distribution()
dd.__plot__("dd",(800,800),None)

```---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-2-b1f5212d1b98> in <module>()
1 dd = g.degree_distribution()
----> 2 dd.__plot__("dd",(800,800),None)

/usr/local/lib/python3.5/site-packages/igraph/statistics.py in __plot__(self, context, bbox, _, **kwds)
239         coord_system = DescartesCoordinateSystem(context, bbox, \
240             (kwds.get("min", self._min), 0, \
--> 241              kwds.get("max", self._max), kwds.get("max_value", max(self._bins))
242             ))
243

/usr/local/lib/python3.5/site-packages/igraph/drawing/coord.py in __init__(self, context, bbox, bounds)
67
68         self.bbox = bbox
---> 69         self.bounds = bounds
70
71     @property

/usr/local/lib/python3.5/site-packages/igraph/drawing/coord.py in bounds(self, bounds)
89         """Sets the lower and upper bounds of the X and Y values"""
90         self._bounds = BoundingBox(bounds)
---> 91         self._recalc_scale_factors()
92
93     def _recalc_scale_factors(self):

/usr/local/lib/python3.5/site-packages/igraph/drawing/coord.py in _recalc_scale_factors(self)
95         if self._bounds is None:
96             return
---> 97         self._sx = self._bbox.width / self._bounds.width
98         self._sy = self._bbox.height / self._bounds.height
99         self._ox = self._bounds.left

AttributeError: 'tuple' object has no attribute 'width'```

Thanks a lot!
sizheng