Vertex text size proportional to the size of the vertex
Dear all, I am drawing a graph with the names of the vertex on each vertex. I am also specifying that the sizes of vertices should be "proportional" to their degree values (high degree vertices are bigger). Now, I want to do the same for the vertex text also. Something like this: size = g.new_vertex_property('float') text_size = g.new_vertex_property('float') for v in g.vertices(): size[v] = 4 * np.sqrt(v.out_degree()) + 5 text_size = 0.2 * size[v] gt.graph_draw(g, vertex_size = size, vertex_text = names, vertex_font_size = text_size, output = 'test.pdf') However, this doesn't produce the desired result. What happens is that if the vertex name is longer, the size of the vertex gets increased to accommodate the text inside the vertex. I don't want this. I want all the vertices with the same degree to have the same size, and the text size inside the bigger vertex should be bigger. I am okay if the text goes outside the vertex. How can I achieve this? Thank you -- Snehal M. Shekatkar Pune India www.snehalshekatkar.com
On 11.12.2017 06:25, Snehal Shekatkar wrote:
However, this doesn't produce the desired result. What happens is that if the vertex name is longer, the size of the vertex gets increased to accommodate the text inside the vertex. I don't want this. I want all the vertices with the same degree to have the same size, and the text size inside the bigger vertex should be bigger. I am okay if the text goes outside the vertex. How can I achieve this?
Just use: vertex_text_position=0 -- Tiago de Paula Peixoto <tiago@skewed.de>
Worked! How can I make the text bold also? Thank you On Dec 12, 2017 12:02 AM, "Tiago de Paula Peixoto" <tiago@skewed.de> wrote:
On 11.12.2017 06:25, Snehal Shekatkar wrote:
However, this doesn't produce the desired result. What happens is that if the vertex name is longer, the size of the vertex gets increased to accommodate the text inside the vertex. I don't want this. I want all the vertices with the same degree to have the same size, and the text size inside the bigger vertex should be bigger. I am okay if the text goes outside the vertex. How can I achieve this?
Just use: vertex_text_position=0
-- Tiago de Paula Peixoto <tiago@skewed.de>
_______________________________________________ graph-tool mailing list graph-tool@skewed.de https://lists.skewed.de/mailman/listinfo/graph-tool
participants (2)
-
Snehal Shekatkar -
Tiago de Paula Peixoto