Vertex Position for plotting NestedBlockState
Is there a possibility to get the nodes Positions from a NestedBlockState Object? -- View this message in context: http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/... Sent from the Main discussion list for the graph-tool project mailing list archive at Nabble.com.
On 01.11.2016 11:23, philipplorenz wrote:
Is there a possibility to get the nodes Positions from a NestedBlockState Object?
There are no node positions in NestedBlockState. Could you be more specific about what you want to achieve? -- Tiago de Paula Peixoto <tiago@skewed.de>
I wanted to plot labels around the state.draw plot in a circular way. For this I need the position on the circle in order to calculate the angle. If I use the hierarchical tree layout, blocks are then switched in the plot and the angles are wrong. My solution is using the state.draw function, which returns the positions first, then calculate the angles for the labels and then plot them again. Best Philipp ________________________________ From: Tiago Peixoto [via Main discussion list for the graph-tool project] <ml-node+s982480n4026820h19@n3.nabble.com> Sent: Friday, November 4, 2016 1:05 PM To: Lorenz, Philipp Gert Josef Subject: Re: Vertex Position for plotting NestedBlockState On 01.11.2016 11:23, philipplorenz wrote:
Is there a possibility to get the nodes Positions from a NestedBlockState Object?
There are no node positions in NestedBlockState. Could you be more specific about what you want to achieve? -- Tiago de Paula Peixoto <[hidden email]</user/SendEmail.jtp?type=node&node=4026820&i=0>> _______________________________________________ graph-tool mailing list [hidden email]</user/SendEmail.jtp?type=node&node=4026820&i=1> https://lists.skewed.de/mailman/listinfo/graph-tool -- Tiago de Paula Peixoto <tiago@skewed.de> ________________________________ If you reply to this email, your message will be added to the discussion below: http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/... To unsubscribe from Vertex Position for plotting NestedBlockState, click here<http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4026816&code=cGhpbGlwcC5sb3JlbnpAdHUtYmVybGluLmRlfDQwMjY4MTZ8MTc3NzM2NTAyMQ==>. NAML<http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml> -- View this message in context: http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/... Sent from the Main discussion list for the graph-tool project mailing list archive at Nabble.com.
On 04.11.2016 12:23, philipplorenz wrote:
I wanted to plot labels around the state.draw plot in a circular way. For this I need the position on the circle in order to calculate the angle.
If you use text_position="centered" this will be done automatically (assuming I'm interpreting correctly).
If I use the hierarchical tree layout, blocks are then switched in the plot and the angles are wrong.
Without a complete, self-contained example, it is hard to say what may be happening. Best, Tiago -- Tiago de Paula Peixoto <tiago@skewed.de>
Sorry for the incomplete description. Here is my code: state = gt.minimize_nested_blockmodel_dl(new_graph, deg_corr=True) pos = state.draw( output='2015_'+str(j+1)+'_nested.png', output_size=(900, 900))[0] text_rot = new_graph.new_vertex_property('double') new_graph.vertex_properties['text_rot'] = text_rot for v in new_graph.vertices(): if pos[v][0] >0: text_rot[v] = math.atan(pos[v][1]/pos[v][0]) else: text_rot[v] = math.pi + math.atan(pos[v][1]/pos[v][0]) state.draw( output='2015_'+str(j+1)+'_nested.png', output_size=(900, 900), vertex_text=v_prop, vertex_size=v_size, vertex_fill_color=b, vertex_shape=shape, vertex_font_size=12, vertex_text_position=0, vertex_text_rotation=new_graph.vertex_properties['text_rot'], bg_color=[0,0,0,1]) My question is how to get the correct pos values for the vertices. Instead of this line: pos = state.draw( output='2015_'+str(j+1)+'_nested.png', output_size=(900, 900))[0] which might not be the most elegant way to solve this problem. Best Philipp ________________________________ From: Tiago Peixoto [via Main discussion list for the graph-tool project] <ml-node+s982480n4026822h81@n3.nabble.com> Sent: Friday, November 4, 2016 1:29 PM To: Lorenz, Philipp Gert Josef Subject: Re: Vertex Position for plotting NestedBlockState On 04.11.2016 12:23, philipplorenz wrote:
I wanted to plot labels around the state.draw plot in a circular way. For this I need the position on the circle in order to calculate the angle.
If you use text_position="centered" this will be done automatically (assuming I'm interpreting correctly).
If I use the hierarchical tree layout, blocks are then switched in the plot and the angles are wrong.
Without a complete, self-contained example, it is hard to say what may be happening. Best, Tiago -- Tiago de Paula Peixoto <[hidden email]</user/SendEmail.jtp?type=node&node=4026822&i=0>> _______________________________________________ graph-tool mailing list [hidden email]</user/SendEmail.jtp?type=node&node=4026822&i=1> https://lists.skewed.de/mailman/listinfo/graph-tool [http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/...] signature.asc (817 bytes) Download Attachment<http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/attachment/4026822/0/signature.asc> -- Tiago de Paula Peixoto <tiago@skewed.de> ________________________________ If you reply to this email, your message will be added to the discussion below: http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/... To unsubscribe from Vertex Position for plotting NestedBlockState, click here<http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4026816&code=cGhpbGlwcC5sb3JlbnpAdHUtYmVybGluLmRlfDQwMjY4MTZ8MTc3NzM2NTAyMQ==>. NAML<http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml> -- View this message in context: http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/... Sent from the Main discussion list for the graph-tool project mailing list archive at Nabble.com.
participants (2)
-
philipplorenz -
Tiago de Paula Peixoto