点/Graphviz的更紧凑的分层布局 [英] More compact hierarchical layout for dot / Graphviz
问题描述
我生成带有点的以下PDF: >
我的主要问题是,即使在 A3 上打印,字符大小也太小.同样,可以使该图更紧凑.例如.左上角存在蓝色,绿色和棕色节点,从而扩大了宽度,但是我看不出为什么前两行都不能向右移动,从而至少减少了20%宽度.我将 .gv 文件附加在末尾.
由于我自动生成了 .gv 文件,因此我只能修改图形级属性或所有节点和边的属性,或者更改点调用,但是我可以t调整坐标或特定节点.
您是否看到任何明显的方法可以获得更紧凑的布局以允许更大的字符大小?
我使用的调用是:
dot -Gsize="16.52,11.68" -Gratio="fill" -Glandscape=false -Gsplines=ortho -Tpdf graph.gv -o graph.gv.pdf
graph.gv文件
digraph G {
node [
fontname="Times-Bold"
]
concentrate=true
"schemas/toolkit.xsd" [
shape = "record"
style="bold, filled"
fillcolor="cyan"
label = "{toolkit.xsd|vt.edu|OAI/metadata/toolkit}"
]
"schemas/simpledc20021212.xsd" [
shape = "record"
style="bold, filled"
fillcolor="salmon3"
label = "{simpledc20021212.xsd|other domain|http://purl.org/dc/elements/1.1/}"
]
"schemas/stc-v1.30.xsd" [
shape = "record"
style="bold, filled"
fillcolor="lightskyblue"
label = "{stc-v1.30.xsd|ivoa|STC/stc-v1.30.xsd}"
]
"schemas/oai_dc.xsd" [
shape = "record"
style="bold, filled"
fillcolor="limegreen"
label = "{oai_dc.xsd|openarchives|OAI/2.0/oai_dc/}"
]
"schemas/VOApplication.xsd" [
shape = "record"
style="bold, filled"
fillcolor="lightskyblue"
label = "{VOApplication.xsd|ivoa|VOApplication/v1.0rc1}"
]
"schemas/xml.xsd" [
shape = "record"
style="bold, filled"
fillcolor="violetred1"
label = "{xml.xsd|w3.org|XML/1998/namespace}"
]
"schemas/xlink.xsd" [
shape = "record"
style="bold, filled"
fillcolor="violetred1"
label = "{xlink.xsd|w3.org|1999/xlink}"
]
"schemas/OpenSkyNode-v0.2.xsd" [
shape = "record"
style="bold, filled"
fillcolor="lightskyblue"
label = "{OpenSkyNode-v0.2.xsd|ivoa|SkyNode/v0.2}"
]
"schemas/VORegistry-v1.0.xsd" [
shape = "record"
style="bold, filled"
fillcolor="lightskyblue"
label = "{VORegistry-v1.0.xsd|ivoa|VORegistry/v1.0}"
]
"schemas/VOResource-v1.0.xsd" [
shape = "record"
style="bold, filled"
fillcolor="lightskyblue"
label = "{VOResource-v1.0.xsd|ivoa|VOResource/v1.0}"
]
"schemas/ConeSearch-v1.0.xsd" [
shape = "record"
style="bold, filled"
fillcolor="lightskyblue"
label = "{ConeSearch-v1.0.xsd|ivoa|ConeSearch/v1.0}"
]
"schemas/CEAService.xsd" [
shape = "record"
style="bold, filled"
fillcolor="lightskyblue"
label = "{CEAService.xsd|ivoa|CEA/v1.0rc1}"
]
"schemas/VOTable.xsd" [
shape = "record"
style="bold, filled"
fillcolor="lightskyblue"
label = "{VOTable.xsd|ivoa|VOTable/v1.1}"
]
"schemas/CEABase.xsd" [
shape = "record"
style="bold, filled"
fillcolor="lightskyblue"
label = "{CEABase.xsd|ivoa|CEA/base/v1.0rc1}"
]
"schemas/STAP.xsd" [
shape = "record"
style="bold, filled"
fillcolor="yellow"
label = "{STAP.xsd|astrogrid urn|STAP:v1.0}"
]
"schemas/VODataService-v1.0.xsd" [
shape = "record"
style="bold, filled"
fillcolor="lightskyblue"
label = "{VODataService-v1.0.xsd|ivoa|VODataService/v1.0}"
]
"schemas/SIA-v1.0.xsd" [
shape = "record"
style="bold, filled"
fillcolor="lightskyblue"
label = "{SIA-v1.0.xsd|ivoa|SIA/v1.0}"
]
"schemas/SSA-v0.4.xsd" [
shape = "record"
style="bold, filled"
fillcolor="lightskyblue"
label = "{SSA-v0.4.xsd|ivoa|SSA/v0.4}"
]
"schemas/RegistryInterface-v1.0.xsd" [
shape = "record"
style="bold, filled"
fillcolor="lightskyblue"
label = "{RegistryInterface-v1.0.xsd|ivoa|RegistryInterface/v1.0}"
]
"schemas/SSA-v1.0.xsd" [
shape = "record"
style="bold, filled"
fillcolor="lightskyblue"
label = "{SSA-v1.0.xsd|ivoa|SSA/v1.0}"
]
"schemas/TAPRegExt-v1.0.xsd" [
shape = "record"
style="bold, filled"
fillcolor="lightskyblue"
label = "{TAPRegExt-v1.0.xsd|ivoa|TAPRegExt/v1.0}"
]
"NFhttp://www.ivoa.net/xml/VOMetadata/v0.1" [
shape = "record"
color = "magenta1"
fillcolor = "lemonchiffon1"
style="bold, dashed, rounded, filled"
label = "{ivoa|VOMetadata/v0.1}"
]
"NFhttp://www.w3.org/2001/XMLSchema-instance" [
shape = "record"
color = "magenta1"
fillcolor = "lemonchiffon1"
style="bold, dashed, rounded, filled"
label = "{w3.org|2001/XMLSchema-instance}"
]
"schemas/stc-v1.30.xsd" -> "schemas/xlink.xsd" [color="blue"]
"schemas/oai_dc.xsd" -> "schemas/simpledc20021212.xsd" [color="blue"]
"schemas/VOApplication.xsd" -> "schemas/VOResource-v1.0.xsd" [color="blue"]
"schemas/VOApplication.xsd" -> "NFhttp://www.ivoa.net/xml/VOMetadata/v0.1" [color="blue"]
"schemas/OpenSkyNode-v0.2.xsd" -> "schemas/VOResource-v1.0.xsd" [color="blue"]
"schemas/OpenSkyNode-v0.2.xsd" -> "schemas/VODataService-v1.0.xsd" [color="blue"]
"schemas/OpenSkyNode-v0.2.xsd" -> "NFhttp://www.ivoa.net/xml/VOMetadata/v0.1" [color="blue"]
"schemas/VORegistry-v1.0.xsd" -> "schemas/VOResource-v1.0.xsd" [color="blue"]
"schemas/VORegistry-v1.0.xsd" -> "NFhttp://www.ivoa.net/xml/VOMetadata/v0.1" [color="blue"]
"schemas/VOResource-v1.0.xsd" -> "NFhttp://www.ivoa.net/xml/VOMetadata/v0.1" [color="blue"]
"schemas/ConeSearch-v1.0.xsd" -> "schemas/VOResource-v1.0.xsd" [color="blue"]
"schemas/ConeSearch-v1.0.xsd" -> "NFhttp://www.ivoa.net/xml/VOMetadata/v0.1" [color="blue"]
"schemas/CEAService.xsd" -> "schemas/VOTable.xsd" [color="blue"]
"schemas/CEAService.xsd" -> "schemas/VODataService-v1.0.xsd" [color="blue"]
"schemas/CEAService.xsd" -> "schemas/VOResource-v1.0.xsd" [color="blue"]
"schemas/CEAService.xsd" -> "NFhttp://www.ivoa.net/xml/VOMetadata/v0.1" [color="blue"]
"schemas/CEAService.xsd" -> "schemas/CEABase.xsd" [color="blue"]
"schemas/CEAService.xsd" -> "schemas/VOApplication.xsd" [color="blue"]
"schemas/CEABase.xsd" -> "schemas/VODataService-v1.0.xsd" [color="blue"]
"schemas/STAP.xsd" -> "schemas/VOResource-v1.0.xsd" [color="blue"]
"schemas/VODataService-v1.0.xsd" -> "schemas/VOResource-v1.0.xsd" [color="blue"]
"schemas/VODataService-v1.0.xsd" -> "schemas/stc-v1.30.xsd" [color="blue"]
"schemas/VODataService-v1.0.xsd" -> "NFhttp://www.ivoa.net/xml/VOMetadata/v0.1" [color="blue"]
"schemas/SIA-v1.0.xsd" -> "schemas/VOResource-v1.0.xsd" [color="blue"]
"schemas/SIA-v1.0.xsd" -> "schemas/VODataService-v1.0.xsd" [color="blue"]
"schemas/SIA-v1.0.xsd" -> "NFhttp://www.ivoa.net/xml/VOMetadata/v0.1" [color="blue"]
"schemas/SSA-v0.4.xsd" -> "schemas/VOResource-v1.0.xsd" [color="blue"]
"schemas/SSA-v0.4.xsd" -> "schemas/VODataService-v1.0.xsd" [color="blue"]
"schemas/SSA-v0.4.xsd" -> "NFhttp://www.ivoa.net/xml/VOMetadata/v0.1" [color="blue"]
"schemas/RegistryInterface-v1.0.xsd" -> "schemas/VOResource-v1.0.xsd" [color="blue"]
"schemas/SSA-v1.0.xsd" -> "schemas/VOResource-v1.0.xsd" [color="blue"]
"schemas/SSA-v1.0.xsd" -> "NFhttp://www.ivoa.net/xml/VOMetadata/v0.1" [color="blue"]
"schemas/TAPRegExt-v1.0.xsd" -> "schemas/VOResource-v1.0.xsd" [color="blue"]
"schemas/TAPRegExt-v1.0.xsd" -> "NFhttp://www.ivoa.net/xml/VOMetadata/v0.1" [color="blue"]
"schemas/TAPRegExt-v1.0.xsd" -> "NFhttp://www.w3.org/2001/XMLSchema-instance" [color="blue"]
}
unflatten
实用程序可以生成更紧凑的图形.
尝试以下命令行:
unflatten -f -l 2 graph.gv | dot -Gsize="16.52,11.68" -Gratio="fill" -Glandscape=false -Gsplines=ortho -Tpdf -o graph.gv.pdf
根据您自动生成的各种图形,未平整度的其他一些值也许更适合覆盖所有图形.
I produce the following PDF with dot:
My main problem is that the character size is too small even when printed on A3. Also it appears that the graph could be made more compact. E.g. the width is extended by the presence of the blue, green and brown nodes on the upper left corner, but I see no reason why the entire first two rows could not be shifted to the right, to result in an at least 20% reduction of width. I attach the .gv file at the end.
Since I automatically generate the .gv file I can only modify graph-level attributes or attributes for all nodes and edges or change the dot invocation, but I can't fine-tune coordinates or particular nodes.
Do you see any obvious ways I could get a more compact layout that would allow larger character sizes?
The invocation I use is:
dot -Gsize="16.52,11.68" -Gratio="fill" -Glandscape=false -Gsplines=ortho -Tpdf graph.gv -o graph.gv.pdf
graph.gv file
digraph G {
node [
fontname="Times-Bold"
]
concentrate=true
"schemas/toolkit.xsd" [
shape = "record"
style="bold, filled"
fillcolor="cyan"
label = "{toolkit.xsd|vt.edu|OAI/metadata/toolkit}"
]
"schemas/simpledc20021212.xsd" [
shape = "record"
style="bold, filled"
fillcolor="salmon3"
label = "{simpledc20021212.xsd|other domain|http://purl.org/dc/elements/1.1/}"
]
"schemas/stc-v1.30.xsd" [
shape = "record"
style="bold, filled"
fillcolor="lightskyblue"
label = "{stc-v1.30.xsd|ivoa|STC/stc-v1.30.xsd}"
]
"schemas/oai_dc.xsd" [
shape = "record"
style="bold, filled"
fillcolor="limegreen"
label = "{oai_dc.xsd|openarchives|OAI/2.0/oai_dc/}"
]
"schemas/VOApplication.xsd" [
shape = "record"
style="bold, filled"
fillcolor="lightskyblue"
label = "{VOApplication.xsd|ivoa|VOApplication/v1.0rc1}"
]
"schemas/xml.xsd" [
shape = "record"
style="bold, filled"
fillcolor="violetred1"
label = "{xml.xsd|w3.org|XML/1998/namespace}"
]
"schemas/xlink.xsd" [
shape = "record"
style="bold, filled"
fillcolor="violetred1"
label = "{xlink.xsd|w3.org|1999/xlink}"
]
"schemas/OpenSkyNode-v0.2.xsd" [
shape = "record"
style="bold, filled"
fillcolor="lightskyblue"
label = "{OpenSkyNode-v0.2.xsd|ivoa|SkyNode/v0.2}"
]
"schemas/VORegistry-v1.0.xsd" [
shape = "record"
style="bold, filled"
fillcolor="lightskyblue"
label = "{VORegistry-v1.0.xsd|ivoa|VORegistry/v1.0}"
]
"schemas/VOResource-v1.0.xsd" [
shape = "record"
style="bold, filled"
fillcolor="lightskyblue"
label = "{VOResource-v1.0.xsd|ivoa|VOResource/v1.0}"
]
"schemas/ConeSearch-v1.0.xsd" [
shape = "record"
style="bold, filled"
fillcolor="lightskyblue"
label = "{ConeSearch-v1.0.xsd|ivoa|ConeSearch/v1.0}"
]
"schemas/CEAService.xsd" [
shape = "record"
style="bold, filled"
fillcolor="lightskyblue"
label = "{CEAService.xsd|ivoa|CEA/v1.0rc1}"
]
"schemas/VOTable.xsd" [
shape = "record"
style="bold, filled"
fillcolor="lightskyblue"
label = "{VOTable.xsd|ivoa|VOTable/v1.1}"
]
"schemas/CEABase.xsd" [
shape = "record"
style="bold, filled"
fillcolor="lightskyblue"
label = "{CEABase.xsd|ivoa|CEA/base/v1.0rc1}"
]
"schemas/STAP.xsd" [
shape = "record"
style="bold, filled"
fillcolor="yellow"
label = "{STAP.xsd|astrogrid urn|STAP:v1.0}"
]
"schemas/VODataService-v1.0.xsd" [
shape = "record"
style="bold, filled"
fillcolor="lightskyblue"
label = "{VODataService-v1.0.xsd|ivoa|VODataService/v1.0}"
]
"schemas/SIA-v1.0.xsd" [
shape = "record"
style="bold, filled"
fillcolor="lightskyblue"
label = "{SIA-v1.0.xsd|ivoa|SIA/v1.0}"
]
"schemas/SSA-v0.4.xsd" [
shape = "record"
style="bold, filled"
fillcolor="lightskyblue"
label = "{SSA-v0.4.xsd|ivoa|SSA/v0.4}"
]
"schemas/RegistryInterface-v1.0.xsd" [
shape = "record"
style="bold, filled"
fillcolor="lightskyblue"
label = "{RegistryInterface-v1.0.xsd|ivoa|RegistryInterface/v1.0}"
]
"schemas/SSA-v1.0.xsd" [
shape = "record"
style="bold, filled"
fillcolor="lightskyblue"
label = "{SSA-v1.0.xsd|ivoa|SSA/v1.0}"
]
"schemas/TAPRegExt-v1.0.xsd" [
shape = "record"
style="bold, filled"
fillcolor="lightskyblue"
label = "{TAPRegExt-v1.0.xsd|ivoa|TAPRegExt/v1.0}"
]
"NFhttp://www.ivoa.net/xml/VOMetadata/v0.1" [
shape = "record"
color = "magenta1"
fillcolor = "lemonchiffon1"
style="bold, dashed, rounded, filled"
label = "{ivoa|VOMetadata/v0.1}"
]
"NFhttp://www.w3.org/2001/XMLSchema-instance" [
shape = "record"
color = "magenta1"
fillcolor = "lemonchiffon1"
style="bold, dashed, rounded, filled"
label = "{w3.org|2001/XMLSchema-instance}"
]
"schemas/stc-v1.30.xsd" -> "schemas/xlink.xsd" [color="blue"]
"schemas/oai_dc.xsd" -> "schemas/simpledc20021212.xsd" [color="blue"]
"schemas/VOApplication.xsd" -> "schemas/VOResource-v1.0.xsd" [color="blue"]
"schemas/VOApplication.xsd" -> "NFhttp://www.ivoa.net/xml/VOMetadata/v0.1" [color="blue"]
"schemas/OpenSkyNode-v0.2.xsd" -> "schemas/VOResource-v1.0.xsd" [color="blue"]
"schemas/OpenSkyNode-v0.2.xsd" -> "schemas/VODataService-v1.0.xsd" [color="blue"]
"schemas/OpenSkyNode-v0.2.xsd" -> "NFhttp://www.ivoa.net/xml/VOMetadata/v0.1" [color="blue"]
"schemas/VORegistry-v1.0.xsd" -> "schemas/VOResource-v1.0.xsd" [color="blue"]
"schemas/VORegistry-v1.0.xsd" -> "NFhttp://www.ivoa.net/xml/VOMetadata/v0.1" [color="blue"]
"schemas/VOResource-v1.0.xsd" -> "NFhttp://www.ivoa.net/xml/VOMetadata/v0.1" [color="blue"]
"schemas/ConeSearch-v1.0.xsd" -> "schemas/VOResource-v1.0.xsd" [color="blue"]
"schemas/ConeSearch-v1.0.xsd" -> "NFhttp://www.ivoa.net/xml/VOMetadata/v0.1" [color="blue"]
"schemas/CEAService.xsd" -> "schemas/VOTable.xsd" [color="blue"]
"schemas/CEAService.xsd" -> "schemas/VODataService-v1.0.xsd" [color="blue"]
"schemas/CEAService.xsd" -> "schemas/VOResource-v1.0.xsd" [color="blue"]
"schemas/CEAService.xsd" -> "NFhttp://www.ivoa.net/xml/VOMetadata/v0.1" [color="blue"]
"schemas/CEAService.xsd" -> "schemas/CEABase.xsd" [color="blue"]
"schemas/CEAService.xsd" -> "schemas/VOApplication.xsd" [color="blue"]
"schemas/CEABase.xsd" -> "schemas/VODataService-v1.0.xsd" [color="blue"]
"schemas/STAP.xsd" -> "schemas/VOResource-v1.0.xsd" [color="blue"]
"schemas/VODataService-v1.0.xsd" -> "schemas/VOResource-v1.0.xsd" [color="blue"]
"schemas/VODataService-v1.0.xsd" -> "schemas/stc-v1.30.xsd" [color="blue"]
"schemas/VODataService-v1.0.xsd" -> "NFhttp://www.ivoa.net/xml/VOMetadata/v0.1" [color="blue"]
"schemas/SIA-v1.0.xsd" -> "schemas/VOResource-v1.0.xsd" [color="blue"]
"schemas/SIA-v1.0.xsd" -> "schemas/VODataService-v1.0.xsd" [color="blue"]
"schemas/SIA-v1.0.xsd" -> "NFhttp://www.ivoa.net/xml/VOMetadata/v0.1" [color="blue"]
"schemas/SSA-v0.4.xsd" -> "schemas/VOResource-v1.0.xsd" [color="blue"]
"schemas/SSA-v0.4.xsd" -> "schemas/VODataService-v1.0.xsd" [color="blue"]
"schemas/SSA-v0.4.xsd" -> "NFhttp://www.ivoa.net/xml/VOMetadata/v0.1" [color="blue"]
"schemas/RegistryInterface-v1.0.xsd" -> "schemas/VOResource-v1.0.xsd" [color="blue"]
"schemas/SSA-v1.0.xsd" -> "schemas/VOResource-v1.0.xsd" [color="blue"]
"schemas/SSA-v1.0.xsd" -> "NFhttp://www.ivoa.net/xml/VOMetadata/v0.1" [color="blue"]
"schemas/TAPRegExt-v1.0.xsd" -> "schemas/VOResource-v1.0.xsd" [color="blue"]
"schemas/TAPRegExt-v1.0.xsd" -> "NFhttp://www.ivoa.net/xml/VOMetadata/v0.1" [color="blue"]
"schemas/TAPRegExt-v1.0.xsd" -> "NFhttp://www.w3.org/2001/XMLSchema-instance" [color="blue"]
}
The unflatten
utility can lead to a more compact graph.
Try the following command line:
unflatten -f -l 2 graph.gv | dot -Gsize="16.52,11.68" -Gratio="fill" -Glandscape=false -Gsplines=ortho -Tpdf -o graph.gv.pdf
Depending on your various automatically generated graphs, maybe some other values for unflatten are more appropriate to cover all of them.
这篇关于点/Graphviz的更紧凑的分层布局的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!