首页 > 解决方案 > TypeError:绘图不可用(Google Colab)

问题描述

这是我在使用情节时遇到的错误。imort cairo 没有给出任何错误,这意味着 igraph 用于绘图的库已安装,但仍显示错误。谁能帮我解决这个问题。

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-18-8ddaf3cef6bc> in <module>()
      1 layout = G.layout("kk")
----> 2 plot(G , layout = layout)

2 frames
/usr/local/lib/python3.6/dist-packages/igraph/drawing/__init__.py in plot(obj, target, bbox, *args, **kwds)
    444         bbox = BoundingBox(bbox)
    445 
--> 446     result = Plot(target, bbox, background=kwds.get("background", "white"))
    447 
    448     if "margin" in kwds:

/usr/local/lib/python3.6/dist-packages/igraph/drawing/__init__.py in __init__(self, target, bbox, palette, background)
    115         """
    116         self._filename = None
--> 117         self._surface_was_created = not isinstance(target, cairo.Surface)
    118         self._need_tmpfile = False
    119 

/usr/local/lib/python3.6/dist-packages/igraph/drawing/utils.py in __getattr__(self, _)
    394 
    395     def __getattr__(self, _):
--> 396         raise TypeError("plotting not available")
    397     def __call__(self, _):
    398         raise TypeError("plotting not available")


TypeError: plotting not available

标签: pythonplotigraphgoogle-colaboratory

解决方案


推荐阅读