Nested blockmodel: draw_hierarchy vertex labels are rotated by 180 degrees
Bug reports:
Please follow the general troubleshooting steps first:
-
Are you running the latest graph-tool
version? -
Do you observe the problem with the current git version? -
Are you using Macports or Homebrew? If yes, please submit an issue there instead: https://github.com/Homebrew/brew/issues and https://trac.macports.org/newticket -
Did you compile graph-tool
manually? -
If you answered yes above, did you use the exact same compiler to build graph-tool
,boost-python
andPython
?
My graph has 3841 vertices and 324543 weighted edges. When I run minimize_nested_blockmodel_dl
and then draw the graph with:
draw_hierarchy(state, layout='radial', vertex_text=vtxt, vertex_font_family="DejaVu Sans", vertex_text_position=0,
vertex_text_rotation=0, hvertex_text='block', hvertex_text_position=0)
all vertex labels are drawn upside down and right to left, that is are rotated by 180 degrees. This happens only for some vertex_text property maps and for larger graphs; I don't know the minimum graph size, but it seems to be around 1500 vertices.
My vertex text property map is a bit specific, because some strings are quite long (up to 100 chars) and contain Unicode Polish characters.
The bug can be replicated by running the code below. The plot file and labels file are available at https://drive.google.com/open?id=1sYrbJwkVJHUpkcRIRcxYxF9Zh6rInaw5
import math
import numpy as np
import pandas as pd
from graph_tool.all import *
G = load_graph('./nested_dl.gt')
vtxt = G.new_vp('string')
txt_arr = np.load('nested_labels.npy')
vtxt.set_2d_array(txt_arr)
state = minimize_nested_blockmodel_dl(G, deg_corr=True)
draw_hierarchy(state, layout='radial', vertex_text=vtxt, vertex_font_family="DejaVu Sans", vertex_text_position=0,
vertex_text_rotation=0, hvertex_text='block', hvertex_text_position=0)
draw_hierarchy(state, layout='sfdp', vertex_text=vtxt, vertex_font_family="DejaVu Sans", vertex_text_position=0,
vertex_text_rotation=-math.pi/4, hvertex_text='block', hvertex_text_position=0)
Both plots rotate vertex labels by 180 degrees. The second plot shows that vertex_text_rotation
parameter works, but in relation to the 'inverted' base rotation.
I use python 3.7.4, the gt.show_config()
output is:
version: 2.30dev (commit d9a6289b, )
gcc version: 9.1.0
compilation flags: -DNDEBUG -fopenmp -O3 -fvisibility=default -fvisibility-inlines-hidden -Wno-deprecated -Wall -Wextra -ftemplate-backtrace-limit=0 -Wno-register
install prefix: /home/michal/.local
python dir: /home/michal/.local/share/virtualenvs/mpltest-LLU-DPRO/lib/python3.7/site-packages
graph filtering: True
openmp: True
uname: Linux ant 5.2.5-arch1-1-ARCH #1 SMP PREEMPT Wed Jul 31 08:30:34 UTC 2019 x86_64
Cheers, Michał