Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specifying positions of nodes in a graph when rendering? #446

Open
adam2392 opened this issue Dec 15, 2022 · 1 comment
Open

Specifying positions of nodes in a graph when rendering? #446

adam2392 opened this issue Dec 15, 2022 · 1 comment

Comments

@adam2392
Copy link

Hi,

I was wondering if it is possible to render a DiGraph() while specifying the positions?

Reference: py-why/pywhy-graphs#24 (comment)

@rossbar
Copy link
Contributor

rossbar commented Dec 16, 2022

It's certainly possible, but would be quite clunky to do manually. The positions are specified according to the dot language spec; specifically the "pos" attribute of edges. The typical way for setting these values is using one of the graphviz layouts (e.g. A.layout("neato")). In principle, you can set the position attribute manually with something like:

>>> edge = A.get_edge(n1, n2)
>>> edge.attr["pos"] = "some_string_that_conforms_to_the_pos_edge_attr_via_the_dot_standard"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants