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
According to the official Graphviz documentation there is a node attribute called 'pos' that should give me what I want. Also, I'm using dot, and according to this related question at StackOverflow the 'pos' attribute should work with dot. But I don't know the right way to get it. I've been trying things like:
$Vertex1->getAttribute( 'graphviz.pos' );
Because I know that things like the following work:
$Vertex1->getAttribute( 'graphviz.label' );
However I bet that 'label' and 'pos' work very different internally. I imagine that the 'pos' attribute should only be available after rendering the graph with createImageData. But even if I try to get 'pos' after createImageData, I get nothing. Anyone knows how can I get the coordinates of the nodes of the graph?
The text was updated successfully, but these errors were encountered:
This is an excellent question, thanks for posting 👍
I think this (again!) boils down to a lack of documentation (#2) :)
It's tempting to think that accessing the graphviz.pos attribute should return the position within the graph.
However, the attributes only contain those values that are actually set via your own code.
This is because this library only exports a Graph instance and all of its attributes into a format that the GraphViz tool can read in order to produce a resulting graph image. This means that it never actually knows the position of the individual elements.
I've just filed ticket #15 as a feature request so that we could eventually also have a dot importer. This would allow us to do the following:
Export the Graph instance into the dot format
Pass this intermediary dot script as input to GraphViz, asking for dot output
Read in (import / parse) the resulting dot output
Access all automatically generated attributes such as node position etc.
I'm trying to find the way to get the node coordinates or my graph. Say I do a basic graph:
According to the official Graphviz documentation there is a node attribute called 'pos' that should give me what I want. Also, I'm using dot, and according to this related question at StackOverflow the 'pos' attribute should work with dot. But I don't know the right way to get it. I've been trying things like:
Because I know that things like the following work:
However I bet that 'label' and 'pos' work very different internally. I imagine that the 'pos' attribute should only be available after rendering the graph with createImageData. But even if I try to get 'pos' after createImageData, I get nothing. Anyone knows how can I get the coordinates of the nodes of the graph?
The text was updated successfully, but these errors were encountered: