gpt4 book ai didi

python - 使用 PyDot 排列点图的头部?

转载 作者:太空宇宙 更新时间:2023-11-04 08:11:52 24 4
gpt4 key购买 nike

我正在为我的实验室实验制作一个动态生成的图表。这是现在的样子:

experiments graph

理想情况下,我希望蓝色节点在顶部排成一条直线,这样无论导致它们的历史有多大,当前的实验都是可见的。有没有办法在 GraphViz 中做到这一点?我正在使用 PyDot,但也可以手动编辑点图。

我发现了一个可能相关的问题 here , 将它们放在子图中会有帮助吗?

编辑:这是当前的点代码。

digraph depgraph {
rankdir=BT;
dpi=400;
"/experiments/2013-12-19_planmacro" [shape=rectangle, href="/experiments/2013-12-19_planmacro", fontsize=11, color="#61BD4D", label="Plan 96-well plate montage macro", penwidth=2];
"/experiments/2013-07-01_fluoromax" [shape=rectangle, href="/experiments/2013-07-01_fluoromax", fontsize=11, color="#cccccc", label="Testing OD730", penwidth=2];
"/experiments/2013-06-12_cloning" [shape=rectangle, href="/experiments/2013-06-12_cloning", fontsize=11, color="#cccccc", label="Re-cloning TFs", penwidth=2];
"/experiments/2014-01-02_startwt" [shape=rectangle, href="/experiments/2014-01-02_startwt", fontsize=11, color="#61BD4D", label="Start WT Cultures", penwidth=2];
"/experiments/2013-06-04_learning" [shape=rectangle, href="/experiments/2013-06-04_learning", fontsize=11, color="#cccccc", label="Learning R + Bioconductor", penwidth=2];
"/experiments/2013-07-xx_induction" [shape=rectangle, href="/experiments/2013-07-xx_induction", fontsize=11, color="#61BD4D", label="induction again", penwidth=2];
"/experiments/2013-06-04_bg11" [shape=rectangle, href="/experiments/2013-06-04_bg11", fontsize=11, color="#cccccc", label="BG11 Media + Plates", penwidth=2];
"/experiments/2013-06-13_chipseq" [shape=rectangle, href="/experiments/2013-06-13_chipseq", fontsize=11, color="#61BD4D", label="ChIP-Seq Mini-Preps", penwidth=2];
"/experiments/2013-06-06_cloning" [shape=rectangle, href="/experiments/2013-06-06_cloning", fontsize=11, color="#cccccc", label="Re-Cloning TFs", penwidth=2];
"/experiments/2013-06-21_cleaning" [shape=rectangle, href="/experiments/2013-06-21_cleaning", fontsize=11, color="#cccccc", label="cleaning day", penwidth=2];
"/experiments/2013-12-15_rnaextraction" [shape=rectangle, href="/experiments/2013-12-15_rnaextraction", fontsize=11, color="#cccccc", label="Another RNA extraction to test TRI:pellet ratios", penwidth=2];
"/experiments/2013-09-27_iptgplates" [shape=rectangle, href="/experiments/2013-09-27_iptgplates", fontsize=11, color="#61BD4D", label="IPTG Plates", penwidth=2];
"/experiments/2013-06-03_growgfp" [shape=rectangle, href="/experiments/2013-06-03_growgfp", fontsize=11, color="#cccccc", label="Grow sfGFP E. Coli", penwidth=2];
"/experiments/2014-01-02_restreak" [shape=rectangle, href="/experiments/2014-01-02_restreak", fontsize=11, color="#61BD4D", label="Restreak Plates", penwidth=2];
"/experiments/2013-06-25_induction4" [shape=rectangle, href="/experiments/2013-06-25_induction4", fontsize=11, color="#cccccc", label="more careful induction", penwidth=2];
"/experiments/2013-10-05_rnaextraction" [shape=rectangle, href="/experiments/2013-10-05_rnaextraction", fontsize=11, color="#cccccc", label="RNA extraction", penwidth=2];
"/experiments/2013-06-25_induction1" [shape=rectangle, href="/experiments/2013-06-25_induction1", fontsize=11, color="#cccccc", label="GFP induction timepoints", penwidth=2];
"/experiments/2013-06-25_induction3" [shape=rectangle, href="/experiments/2013-06-25_induction3", fontsize=11, color="#cccccc", label="GFP, YFP induction", penwidth=2];
"/experiments/2013-06-25_induction2" [shape=rectangle, href="/experiments/2013-06-25_induction2", fontsize=11, color="#cccccc", label="GFP, YFP Induction", penwidth=2];
"/experiments/2013-06-06_tophatcufflinks" [shape=rectangle, href="/experiments/2013-06-06_tophatcufflinks", fontsize=11, color="#61BD4D", label="Tophat + Cufflinks", penwidth=2];
"/experiments/2013-07-21_methods" [shape=rectangle, href="/experiments/2013-07-21_methods", fontsize=11, color="#cccccc", label="compare extraction methods", penwidth=2];
"/experiments/2013-07-xx_rnaprep" [shape=rectangle, href="/experiments/2013-07-xx_rnaprep", fontsize=11, color="#cccccc", label="RNA isolation prep", penwidth=2];
"/experiments/2013-12-29_depgraph" [shape=rectangle, href="/experiments/2013-12-29_depgraph", fontsize=11, color="#61BD4D", label="Organize metadata", penwidth=2];
"/experiments/2013-06-11_wt" [shape=rectangle, href="/experiments/2013-06-11_wt", fontsize=11, color="#cccccc", label="Grow induced WT", penwidth=2];
"/experiments/2013-08-06_directzol" [shape=rectangle, href="/experiments/2013-08-06_directzol", fontsize=11, color="#61BD4D", label="2nd try at DirectZol", penwidth=2];
"/experiments/2013-06-04_primers" [shape=rectangle, href="/experiments/2013-06-04_primers", fontsize=11, color="#cccccc", label="Check Primers", penwidth=2];
"/experiments/2013-06-04_break" [shape=rectangle, href="/experiments/2013-06-04_break", fontsize=11, color="#cccccc", label="Finals and \"Break\"", penwidth=2];
"/experiments/2013-06-04_overview" [shape=rectangle, href="/experiments/2013-06-04_overview", fontsize=11, color="#cccccc", label="CyanoTF Overview", penwidth=2];
"/experiments/2013-12-17_rnaextraction" [shape=rectangle, href="/experiments/2013-12-17_rnaextraction", fontsize=11, color="#cccccc", label="RNA extraction with varying amounts of TRI", penwidth=2];
"/experiments/2013-06-25_inductionprep" [shape=rectangle, href="/experiments/2013-06-25_inductionprep", fontsize=11, color="#cccccc", label="Induction Prep", penwidth=2];
"/experiments/2013-07-xx_pgtx" [shape=rectangle, href="/experiments/2013-07-xx_pgtx", fontsize=11, color="#cccccc", label="making PGTX", penwidth=2];
"/experiments/2013-06-13_cloning" [shape=rectangle, href="/experiments/2013-06-13_cloning", fontsize=11, color="#cccccc", label="Re-cloning TFs", penwidth=2];
"/experiments/2013-12-11_rnaextraction" [shape=rectangle, href="/experiments/2013-12-11_rnaextraction", fontsize=11, color="#cccccc", label="RNA extraction to test TRI:pellet ratios", penwidth=2];
"/experiments/2013-12-27_depgraph" [shape=rectangle, href="/experiments/2013-12-27_depgraph", fontsize=11, color="#cccccc", label="Working on the DepGraph plugin", penwidth=2];
"/experiments/2013-12-21_buildgitit" [shape=rectangle, href="/experiments/2013-12-21_buildgitit", fontsize=11, color="#cccccc", label="Building Gitit from Source", penwidth=2];
"/experiments/2013-06-11_stanley" [shape=rectangle, href="/experiments/2013-06-11_stanley", fontsize=11, color="#cccccc", label="Stanley Protocols", penwidth=2];
"/experiments/2013-06-24_bgfpc" [shape=rectangle, href="/experiments/2013-06-24_bgfpc", fontsize=11, color="#cccccc", label="100X BG-FPC Media", penwidth=2];
"/experiments/2013-07-10_losses" [shape=rectangle, href="/experiments/2013-07-10_losses", fontsize=11, color="#cccccc", label="taking stock of strains", penwidth=2];
"/experiments/2013-07-22_methods3" [shape=rectangle, href="/experiments/2013-07-22_methods3", fontsize=11, color="#cccccc", label="compare extraction quality", penwidth=2];
"/experiments/2013-06-04_bg11" -> "/experiments/2013-06-04_break" [color="#CCCCCC", fontsize=11, penwidth=2];
"/experiments/2013-06-04_overview" -> "/experiments/2013-12-19_planmacro" [color="#CCCCCC", fontsize=11, penwidth=2];
"/experiments/2013-07-xx_pgtx" -> "/experiments/2013-07-xx_rnaprep" [color="#CCCCCC", fontsize=11, penwidth=2];
"/experiments/2013-07-xx_rnaprep" -> "/experiments/2013-07-21_methods" [color="#CCCCCC", fontsize=11, penwidth=2];
"/experiments/2013-06-04_break" -> "/experiments/2013-06-03_growgfp" [color="#CCCCCC", fontsize=11, penwidth=2];
"/experiments/2013-06-12_cloning" -> "/experiments/2013-06-13_cloning" [color="#CCCCCC", fontsize=11, penwidth=2];
"/experiments/2013-06-04_break" -> "/experiments/2013-06-06_cloning" [color="#CCCCCC", fontsize=11, penwidth=2];
"/experiments/2013-07-22_methods3" -> "/experiments/2013-08-06_directzol" [color="#CCCCCC", fontsize=11, penwidth=2];
"/experiments/2013-06-25_induction2" -> "/experiments/2013-06-25_induction3" [color="#CCCCCC", fontsize=11, penwidth=2];
"/experiments/2013-06-25_induction4" -> "/experiments/2013-07-01_fluoromax" [color="#CCCCCC", fontsize=11, penwidth=2];
"/experiments/2013-06-11_wt" -> "/experiments/2013-06-25_inductionprep" [color="#CCCCCC", fontsize=11, penwidth=2];
"/experiments/2013-06-04_overview" -> "/experiments/2013-12-21_buildgitit" [color="#CCCCCC", fontsize=11, penwidth=2];
"/experiments/2013-06-04_overview" -> "/experiments/2013-06-04_break" [color="#CCCCCC", fontsize=11, penwidth=2];
"/experiments/2013-07-21_methods" -> "/experiments/2013-07-22_methods3" [color="#CCCCCC", fontsize=11, penwidth=2];
"/experiments/2013-12-17_rnaextraction" -> "/experiments/2014-01-02_startwt" [color="#CCCCCC", fontsize=11, penwidth=2];
"/experiments/2013-06-25_induction1" -> "/experiments/2013-06-25_induction2" [color="#CCCCCC", fontsize=11, penwidth=2];
"/experiments/2013-06-04_primers" -> "/experiments/2013-06-06_cloning" [color="#CCCCCC", fontsize=11, penwidth=2];
"/experiments/2013-12-21_buildgitit" -> "/experiments/2013-12-27_depgraph" [color="#CCCCCC", fontsize=11, penwidth=2];
"/experiments/2013-06-04_bg11" -> "/experiments/2013-06-24_bgfpc" [color="#CCCCCC", fontsize=11, penwidth=2];
"/experiments/2013-12-11_rnaextraction" -> "/experiments/2013-12-15_rnaextraction" [color="#CCCCCC", fontsize=11, penwidth=2];
"/experiments/2013-06-11_stanley" -> "/experiments/2013-06-13_chipseq" [color="#CCCCCC", fontsize=11, penwidth=2];
"/experiments/2013-06-04_learning" -> "/experiments/2013-06-06_tophatcufflinks" [color="#CCCCCC", fontsize=11, penwidth=2];
"/experiments/2013-06-04_break" -> "/experiments/2013-06-04_primers" [color="#CCCCCC", fontsize=11, penwidth=2];
"/experiments/2013-12-27_depgraph" -> "/experiments/2013-12-29_depgraph" [color="#CCCCCC", fontsize=11, penwidth=2];
"/experiments/2013-06-25_induction3" -> "/experiments/2013-06-25_induction4" [color="#CCCCCC", fontsize=11, penwidth=2];
"/experiments/2013-06-06_cloning" -> "/experiments/2013-06-12_cloning" [color="#CCCCCC", fontsize=11, penwidth=2];
"/experiments/2013-06-04_overview" -> "/experiments/2013-06-04_bg11" [color="#CCCCCC", fontsize=11, penwidth=2];
"/experiments/2013-06-04_overview" -> "/experiments/2013-07-xx_pgtx" [color="#CCCCCC", fontsize=11, penwidth=2];
"/experiments/2013-07-01_fluoromax" -> "/experiments/2013-07-xx_induction" [color="#CCCCCC", fontsize=11, penwidth=2];
"/experiments/2013-10-05_rnaextraction" -> "/experiments/2013-12-11_rnaextraction" [color="#CCCCCC", fontsize=11, penwidth=2];
"/experiments/2013-12-15_rnaextraction" -> "/experiments/2013-12-17_rnaextraction" [color="#CCCCCC", fontsize=11, penwidth=2];
"/experiments/2013-07-10_losses" -> "/experiments/2013-06-21_cleaning" [color="#CCCCCC", fontsize=11, penwidth=2];
"/experiments/2013-06-25_inductionprep" -> "/experiments/2013-06-25_induction1" [color="#CCCCCC", fontsize=11, penwidth=2];
"/experiments/2013-06-21_cleaning" -> "/experiments/2014-01-02_restreak" [color="#CCCCCC", fontsize=11, penwidth=2];
"/experiments/2013-06-04_overview" -> "/experiments/2013-06-04_learning" [color="#CCCCCC", fontsize=11, penwidth=2];
"/experiments/2013-06-13_cloning" -> "/experiments/2013-07-10_losses" [color="#CCCCCC", fontsize=11, penwidth=2];
"/experiments/2013-07-01_fluoromax" -> "/experiments/2013-09-27_iptgplates" [color="#CCCCCC", fontsize=11, penwidth=2];
"/experiments/2013-06-03_growgfp" -> "/experiments/2013-06-11_wt" [color="#CCCCCC", fontsize=11, penwidth=2];
"/experiments/2013-06-04_overview" -> "/experiments/2013-06-11_stanley" [color="#CCCCCC", fontsize=11, penwidth=2];
"/experiments/2013-06-24_bgfpc" -> "/experiments/2013-06-25_inductionprep" [color="#CCCCCC", fontsize=11, penwidth=2];
"/experiments/2013-07-21_methods" -> "/experiments/2013-10-05_rnaextraction" [color="#CCCCCC", fontsize=11, penwidth=2];
}

最佳答案

您可以使用“rank=same”方法:

strict digraph  {
{rank=same; 3; 4;}
1 -> 2;
1 -> 4;
2 -> 3;
}

enter image description here

此 pydot 代码生成相同的图像:

import pydot

node1 = pydot.Node(1)
node2 = pydot.Node(2)
node3 = pydot.Node(3)
node4 = pydot.Node(4)

P = pydot.Dot()
P.add_edge(pydot.Edge(node1,node2))
P.add_edge(pydot.Edge(node2,node3))
P.add_edge(pydot.Edge(node1,node4))

S = pydot.Subgraph(rank='same')
S.add_node(node3)
S.add_node(node4)
P.add_subgraph(S)
P.write('foo.dot')

关于python - 使用 PyDot 排列点图的头部?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20910596/

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