Why curved edges are invisible in igraph plotting?

五迷三道 提交于 2019-12-24 10:46:42

问题


In python igraph plotting with cairo PDF, curved edges set either by edge_curved = X or autocurve = True, edges are invisible in the PDF output. Same stands for PNG. Arrowheads and all other graphic elements are visible. Setting the edges straight, they become visible. Here is a minimal example:

import igraph
g = igraph.Graph.Erdos_Renyi(n = 23, m = 123)
igraph.plot(g, autocurve = True, edge_width = 0.02)

回答1:


With edge width below 0.051 the curved edges are always invisible. Actually all edge widths >= 0.051 and < 1.0 looks the same on PDF, probably numbers below 1.0 are rounded up, and <= 0.05 rounded to 0.0. On PNG plots there is clear difference in this range of edge widths.

So the solution is to use at least edge_width = 0.051 if you plot curved edges. What is interesting is that straight edges remain visible below edge width 0.051, but they won't look thinner, the width seemingly rounded to probably 1.0. As it can be seen in python igraph's source code, edge.width is passed directly to cairo.Context.set_line_width(). I have seen this latter at many places used with floats below 1.0, probably the result depends on the actual cairo surface.



来源:https://stackoverflow.com/questions/29623689/why-curved-edges-are-invisible-in-igraph-plotting

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!