graph size Issue

Viewed 238

I am using the following packages/versions:

graphviz-2.38 (https://graphviz.gitlab.io/_pages/Download/Download_windows.html)

graphviz py package version: 0.4.3 (https://pypi.org/project/graphviz/)

Note: Tried upgrading to the latest version "0.13.2" as well

python 3.5.4

The graph is generated using Digraph (i.e.)

from graphviz import Digraph

tree = Digraph(comment='Dependency_tree_of_' + Job,format='pdf')
# tree.attr(kw='graph', width="1200pt", height="900pt",fixedsize='true') <-- did not help
tree.node(job, style = "filled", fillcolor = "red")

When I generate the graph locally, the PDF is getting generated as expected. But when I deploy this to azure app service and try to run the python script there, the PDF width is too big and the nodes are all over the place.

Expected: enter image description here

plain format:

graph 1 5.3053 1.5
node A 2.6527 1.25 1.4985 0.5 "King Arthur" solid ellipse black lightgrey
node B 1.2638 0.25 2.5276 0.5 "Sir Bedevere the Wise" solid ellipse black lightgrey
node L 4.0416 0.25 2.5276 0.5 "Sir Lancelot the Brave" solid ellipse black lightgrey
edge A B 4 2.3444 1.0203 2.1574 0.8894 1.9155 0.72009 1.708 0.57486 solid black
edge A L 4 2.9609 1.0203 3.148 0.8894 3.3898 0.72009 3.5973 0.57486 solid black
edge B L 4 2.5279 0.25 2.5641 0.25 2.6003 0.25 2.6365 0.25 solid black
stop

enter image description here

Here is the graph that gets generated on the server: https://www.dropbox.com/s/0wjnwbjg86n0cfl/az_dependency_tree.pdf?dl=0

notice how the edges are indented in the screenshot below which is different when I ran it locally, please see above screenshot.

enter image description here

plain format:

graph 1 149 1.5
node A 74.379 1.25 40.766 0.5 "King Arthur" solid ellipse black lightgrey
node B 37.074 0.25 74.148 0.5 "Sir Bedevere the Wise" solid ellipse black lightgrey
node L 111.7 0.25 74.599 0.5 "Sir Lancelot the Brave" solid ellipse black lightgrey
edge A B 4 66.135 1.0212 60.17 0.86581 52.117 0.65594 46.001 0.49655 solid black
edge A L 4 82.627 1.0212 88.592 0.86584 96.646 0.65604 102.76 0.49666 solid black
edge B L 4 74.149 0.25 74.186 0.25 74.222 0.25 74.258 0.25 solid black
stop

Please let me know if you have any tips/ideas to address this.

thanks

1 Answers

Seeing the graph 1 149 1.5 as plain text output guess you need/could/should use the Graph size attribute.

According to the Python graphviz docs

tree = Digraph(comment='Dependency_tree_of_' + Job,format='pdf')
tree.graph_attr["size"] = "8,12"

Maybe the ratio attribute is needed / interferes with size.

Related