Hello Tiago,

I could create the merge request successfully. Thanks so much.

Regards,
Snehal Shekatkar

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Saturday, October 31, 2020 4:56 PM, Snehal Shekatkar 
<snehalshekat...@protonmail.com> wrote:

> Hello Tiago,
>
> It looks like the commit "e3c57b270640f9948d7fda7459376eb40d600719" has 
> introduced a bug in the cairo_draw that I have fixed on my machine but I 
> would like to create a merge request for the same. In short the following 
> code throws the error:
>
> import graph_tool.all as gt
> g = gt.collection.data['karate']
> gt.graph_draw(g, vertex_pen_width=5, vertex_color = 'k', output='test.png')
>
> The error is:
>
> Traceback (most recent call last):
> File "/usr/lib/python3/dist-packages/graph_tool/draw/cairo_draw.py", line 
> 1145, in graph_draw
> x, y, w, h = fit_view
> TypeError: cannot unpack non-iterable bool object
>
> During handling of the above exception, another exception occurred:
>
> Traceback (most recent call last):
> File "test.py", line 4, in <module>
> gt.graph_draw(g, vertex_pen_width=1, output='test.png')
> File "/usr/lib/python3/dist-packages/graph_tool/draw/cairo_draw.py", line 
> 1153, in graph_draw
> x, y, zoom = fit_to_view_ink(g, pos, output_size, vprops,
> File "/usr/lib/python3/dist-packages/graph_tool/draw/cairo_draw.py", line 
> 1345, in fit_to_view_ink
> eprops = dict(eprops, pen_width=min_lw(eprops.get("pen_width")))
> File "/usr/lib/python3/dist-packages/graph_tool/draw/cairo_draw.py", line 
> 1342, in min_lw
> lw = max(lw, 0.1)
> TypeError: '>' not supported between instances of 'float' and 'NoneType'
>
> I tracked the error and it looks to me that in the function ``min_lw`` which 
> itself is inside ``fit_to_view_ink``, if user passes ``pen_width`` only for 
> edges or only for vertices, the other becomes ``None`` and should be handled 
> properly. I could fix this by adding an extra ``if`` condition as follows:
>
> # work around cairo bug with small line widths
> def min_lw(lw):
> if isinstance(lw, PropertyMap):
> lw = lw.copy()
> x = lw.fa
> x[x < 0.05] = 0.1
> lw.fa = x
> else:
> if lw == None:
> lw = 0.1
> lw = max(lw, 0.1)
> return lw
>
> I would like to push this change upstream, but you seem to have denied my 
> access request so I can't create a merge request. If you think this is fine, 
> could you make the change? In general, how do I fix bugs if/when I find them 
> if access on git.skewed is not available?
>
> Thanks and regards,
> Snehal Shekatkar
_______________________________________________
graph-tool mailing list
graph-tool@skewed.de
https://lists.skewed.de/mailman/listinfo/graph-tool

Reply via email to