Hi Tiago,

I am on Ubuntu 16.04 and today I updated from git: '2.23 (commit b669e1b7,
Sun Sep 24 00:01:08 2017 +0200)'.

Till now, I was at least able to draw two graphs in two subplots as said in
my previous email. However, today even that is not working. My code:

import graph_tool.all as gt
import matplotlib.pyplot as plt
plt.switch_backend('cairo')

g1 = gt.collection.data['karate']
g2 = gt.collection.data['dolphins']

ax = plt.subplot(1, 2, 1)
gt.graph_draw(g1, mplfig = ax)
ax = plt.subplot(1, 2, 2)
gt.graph_draw(g2, mplfig = ax)
ax = plt.subplot(2, 2, 3)

plt.savefig('test.pdf')

I get the following error:

Traceback (most recent call last):
  File "test.py", line 20, in <module>
    plt.savefig('abc.pdf')
  File "/usr/lib/python3/dist-packages/matplotlib/pyplot.py", line 688, in
savefig
    res = fig.savefig(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/matplotlib/figure.py", line 1565, in
savefig
    self.canvas.print_figure(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/matplotlib/backend_bases.py", line
2232, in print_figure
    **kwargs)
  File "/usr/lib/python3/dist-packages/matplotlib/backends/backend_cairo.py",
line 448, in print_pdf
    return self._save(fobj, 'pdf', *args, **kwargs)
  File "/usr/lib/python3/dist-packages/matplotlib/backends/backend_cairo.py",
line 512, in _save
    self.figure.draw (renderer)
  File "/usr/lib/python3/dist-packages/matplotlib/artist.py", line 61, in
draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/matplotlib/figure.py", line 1159, in
draw
    func(*args)
  File "/usr/lib/python3/dist-packages/matplotlib/artist.py", line 61, in
draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/matplotlib/axes/_base.py", line
2324, in draw
    a.draw(renderer)
  File "/usr/lib/python3/dist-packages/graph_tool/draw/cairo_draw.py", line
1570, in draw
    self.vorder, self.eorder, self.nodesfirst, self.kwargs)
  File "/usr/lib/python3/dist-packages/graph_tool/draw/cairo_draw.py", line
692, in cairo_draw
    vdefs = _attrs(_vdefaults, "v", g, vcmap)[1]
  File "/usr/lib/python3/dist-packages/graph_tool/draw/cairo_draw.py", line
486, in _attrs
    defaults[int(attr)] = _convert(attr, v, cmap)
  File "/usr/lib/python3/dist-packages/graph_tool/draw/cairo_draw.py", line
323, in _convert
    cmap, alpha = cmap
ValueError: not enough values to unpack (expected 2, got 0)

I tried looking into "cairo_darw.py" but couldn't locate the problem. I
think that it might have something to do with the default color map
default_cm but I am not sure about it. Can you kindly help me with this?

Thank you


On Wed, Aug 2, 2017 at 3:22 PM, Tiago de Paula Peixoto <[email protected]>
wrote:

> On 02.08.2017 07:53, Snehal Shekatkar wrote:
> > Can you kindly suggest some solution on this?
>
> There seems to be a problem with the code, as Alexandre pointed out. I need
> to take a closer look, but I'm out of time.
>
> Please refrain from posting repeated messages like this. If I haven't
> answered yet, is because I did not have a chance. Posting more messages
> does
> not help.
>
> Best,
> Tiago
>
> --
> Tiago de Paula Peixoto <[email protected]>
>
>
> _______________________________________________
> graph-tool mailing list
> [email protected]
> https://lists.skewed.de/mailman/listinfo/graph-tool
>
>


-- 
Snehal M. Shekatkar
Pune
India
_______________________________________________
graph-tool mailing list
[email protected]
https://lists.skewed.de/mailman/listinfo/graph-tool

Reply via email to