Skip to content

Commit f01c8e2

Browse files
authored
distribution on new line in GraphViz node (#3957)
* distribution on new line in GraphViz node * updating tests to check newline instead of space in graphviz graphs
1 parent bca5b88 commit f01c8e2

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

pymc3/model_graph.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ def _make_node(self, var_name, graph):
147147
attrs['shape'] = 'box'
148148

149149
graph.node(var_name.replace(':', '&'),
150-
'{var_name} ~ {distribution}'.format(var_name=var_name, distribution=distribution),
150+
'{var_name}\n~\n{distribution}'.format(var_name=var_name, distribution=distribution),
151151
**attrs)
152152

153153
def get_plates(self):

pymc3/tests/test_data_container.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,12 +188,12 @@ def test_model_to_graphviz_for_model_with_data_container(self):
188188
g = pm.model_to_graphviz(model)
189189

190190
# Data node rendered correctly?
191-
text = 'x [label="x ~ Data" shape=box style="rounded, filled"]'
191+
text = 'x [label="x\n~\nData" shape=box style="rounded, filled"]'
192192
assert text in g.source
193193
# Didn't break ordinary variables?
194-
text = 'beta [label="beta ~ Normal"]'
194+
text = 'beta [label="beta\n~\nNormal"]'
195195
assert text in g.source
196-
text = 'obs [label="obs ~ Normal" style=filled]'
196+
text = 'obs [label="obs\n~\nNormal" style=filled]'
197197
assert text in g.source
198198

199199
def test_explicit_coords(self):

0 commit comments

Comments
 (0)