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

abutting the border when setting engine='neato' #434

Open
Freakwill opened this issue Aug 19, 2022 · 1 comment
Open

abutting the border when setting engine='neato' #434

Freakwill opened this issue Aug 19, 2022 · 1 comment

Comments

@Freakwill
Copy link

Following is my code to draw HMM graph. If I set engine='neato', the nodes will kiss the border of the box of the clusters, else the nodes are not in the write positions. How do I fix the problem?

import graphviz
g = graphviz.Digraph(comment='HMM', filename='HMM.gv', engine='neato')
g.attr(rankdir='LR')

with g.subgraph(name='cluster_1') as c:
    c.attr(style='dashed', pad="10")
    for k, node in enumerate(['X1','X2', 'XX', 'XT']):
        if node == 'XX':
            c.node(node, label='...', shape='plaintext', pos=f'{k}, 1!')
        else:
            c.node(node, pos=f'{k:f}, 1!')
    # c.attr(label='Observable Variables')

with g.subgraph(name='cluster_2') as c:
    c.attr(style='dashed')
    for k, node in enumerate(['Y1','Y2', 'YY', 'YT']):
        if node == 'YY':
            c.node(node, label='...', shape='plaintext', pos=f'{k}, 0!')
        else:
            c.node(node, pos=f'{k:f}, 0!')
    # c.attr(label='Hiden Variables')

g.edges([('Y1', 'Y2'),('Y2', 'YY'), ('YY', 'YT')])

g.edge('Y1', 'X1')
g.edge('Y2', 'X2')
g.edge('YT', 'XT')

g.view()
@jarrodmillman
Copy link
Contributor

You may want to ask your question here: https://github.com/xflr6/graphviz/issues

This is the issue tracker for PyGraphviz and that is the issue tracker for a different Python project called Graphviz.

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