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

distribution on new line in GraphViz node #3957

Merged
merged 2 commits into from
Jun 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pymc3/model_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def _make_node(self, var_name, graph):
attrs['shape'] = 'box'

graph.node(var_name.replace(':', '&'),
'{var_name} ~ {distribution}'.format(var_name=var_name, distribution=distribution),
'{var_name}\n~\n{distribution}'.format(var_name=var_name, distribution=distribution),
**attrs)

def get_plates(self):
Expand Down
6 changes: 3 additions & 3 deletions pymc3/tests/test_data_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,12 +188,12 @@ def test_model_to_graphviz_for_model_with_data_container(self):
g = pm.model_to_graphviz(model)

# Data node rendered correctly?
text = 'x [label="x ~ Data" shape=box style="rounded, filled"]'
text = 'x [label="x\n~\nData" shape=box style="rounded, filled"]'
assert text in g.source
# Didn't break ordinary variables?
text = 'beta [label="beta ~ Normal"]'
text = 'beta [label="beta\n~\nNormal"]'
assert text in g.source
text = 'obs [label="obs ~ Normal" style=filled]'
text = 'obs [label="obs\n~\nNormal" style=filled]'
assert text in g.source

def test_explicit_coords(self):
Expand Down