Skip to content

Commit

Permalink
Hacked around graphviz failing to adjust node sizes to include label.
Browse files Browse the repository at this point in the history
  * Specified min size 1.5" x 1"
  * Changed CR to \\n\\n -- not sure why 2 are needed
These changes may break formatting on other Python/graphviz installs?
  • Loading branch information
ctwardy committed Aug 27, 2014
1 parent aabc550 commit 4c6ad82
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions get_questions.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,11 @@ def get_links(json_Qs, dot=False, labels=False):
# %s
digraph {
graph [label="SciCast Link Structure\n\n", labelloc=top, fontsize=40];
graph [label="SciCast Link Structure\\n\\n", labelloc=top, fontsize=40];
rankdir=LR;
ranksep=.3;
node [style=filled, fillcolor="cornsilk:purple3", color=transparent];
node [style=filled, fillcolor="cornsilk:purple3", color=transparent,
fixedsize=false, shape=box, width=17];
subgraph LEGEND {
label="Legend";
Expand Down Expand Up @@ -155,12 +156,15 @@ def get_shortnames(json_Qs, dot=False, linksonly=True, show_groups=False):
except AttributeError:
pass
if dot:
label = '%s: %s (%s)' % (q['question_id'], sname, groups[:20])
s += '%s [ label="%s"' % (q['question_id'], wrapper.fill(label))
label = '%s: %s' % (q['question_id'], sname)
if show_groups:
label += ' (%s)' % groups[:20]
label = '\\n\\n'.join(wrapper.wrap(label))
s += '%s [ label="%s"' % (q['question_id'], label)
if 'Invalid' in groups:
s += ', shape=Mdiamond, style=dashed, color=gray '
elif q['resolution_at'] != None:
s += ',style=dotted, color=gray '
s += ', style=dotted, color=gray '
s += ']\n'
else:
s += "%s,%s,%s\n" % (q['question_id'], sname, groups)
Expand Down

0 comments on commit 4c6ad82

Please sign in to comment.