pythonmatplotlibdrawgraph-tool

Set zorder for the labels (vertex_text) in graph_tool


I have a case in which vertex_text is hidden behind the one of the vertices (indicated by the red square in the image below). I have drawn this network using graph_tool's circular layout (minimize_nested_blockmodel_dl).

enter image description here

In the graph_tools docs (https://graph-tool.skewed.de/static/doc/draw.html), I did not find any way to set the zorder for the vertex_text.

I wonder if setting zorders for elements is possible in graph_tool. I would like to know if there is any workaround for this, while keeping the plot and the labels as they are i.e. same size, layout and locations.

If this is useful, for reference, here's are the vertex related parameters I used that went into the draw module:

vertex_text=[list of labels],
vertex_fill_color=[list of colors],
valpha=1,
vertex_size=10,
vertex_pen_width=0,
vertex_text_position=-2,

Solution

  • This can be done using the vorder parameter, which determines the relative order with which nodes and their labels are drawn.