gpt4 book ai didi

python-3.x - 图形大小问题

转载 作者:行者123 更新时间:2023-12-03 00:24:28 28 4
gpt4 key购买 nike

我正在使用以下软件包/版本:

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

graphviz py包版本:0.4.3 ( https://pypi.org/project/graphviz/ )

注意:也尝试升级到最新版本“0.13.2”

python3.5.4

该图是使用 Digraph(即)生成的

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")

当我在本地生成图表时,PDF 会按预期生成。但是当我将其部署到 azure 应用程序服务并尝试在那里运行 python 脚本时,PDF 宽度太大并且节点遍布各处。

预计: enter image description here

纯格式:

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

这是在服务器上生成的图表: https://www.dropbox.com/s/0wjnwbjg86n0cfl/az_dependency_tree.pdf?dl=0

请注意下面的屏幕截图中边缘是如何缩进的,这与我在本地运行它时有所不同,请参见上面的屏幕截图。

enter image description here

纯格式:

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

如果您有任何解决此问题的提示/想法,请告诉我。

谢谢

最佳答案

图 1 149 1.5 视为 plain text输出猜测您需要/可以/应该使用图表 size属性。

根据Python graphviz docs

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

也许是 ratio需要属性/干扰大小。

关于python-3.x - 图形大小问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60860471/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com