You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I made the following diagram using Hypernetworkx's draw command.
The node fst_score node appears really close to the 233 hyperedge, making it hard to distinguish whether the node is a member of the hyperedge. Is there a setting an argument somewhere that would allow me to ensure that the hyperedges maintain a minimal distance from the nodes?
The text was updated successfully, but these errors were encountered:
There are several methods for customizing the layout of a hypergraph when using draw. From the documentation:
The default layout algorithm is nx.spring_layout, but other layouts can be passed in. The Hypergraph is converted to a bipartite graph, and the layout algorithm is passed the bipartite graph.
If you have a pre-determined layout, you can pass in a pos dictionary. This is a dictionary mapping from node id’s to x-y coordinates. For example:
pos= {
'A': (0, 0),
'B': (1, 2),
'C': (5, -3)
}
will position the nodes {A, B, C} manually at the locations specified. The coordinate system is in Matplotlib “data coordinates”, and the figure will be centered within the figure.
For small layout adjustments on simple hypergraphs like the one in your example, I recommend doing something like this:
# get the positions for the default layoutpos=hnx.draw(H, return_pos=True)
# for the sake of this example, assume that the original position of the fst_score node is (1,1)# we want to move it up and to the right, so increase the value of both coordinatespos['fst_score'] = (2,2)
# redraw the hypergraph using the updated custom layouthnx.draw(H, pos=pos)
You may need to play around a bit with the updated custom coordinates to achieve your desired layout. Feel free to follow up with specifics/code for your example if you'd like additional support!
I made the following diagram using Hypernetworkx's
draw
command.The node
fst_score
node appears really close to the233
hyperedge, making it hard to distinguish whether the node is a member of the hyperedge. Is there a setting an argument somewhere that would allow me to ensure that the hyperedges maintain a minimal distance from the nodes?The text was updated successfully, but these errors were encountered: