Graphviz:如何在一行中制作时间线/排名

6
我正在尝试创建荷兰能源行业合并的时间轴。我使用rank=same来强制节点保持在同一年份上。然而,时间轴会在自身上产生交错,导致“过去”的节点与“1993”年的节点在同一列中。
如何使年份整齐地保持在一行,并将相应的节点分别放置在不同的列中?
digraph energy_mergers {
ranksep=0.05 
rankdir=LR

{
node [shape=plaintext, fontsize=8];
/* the time-line graph */
{past [shape=plaintext, fontsize=26]}
-> 1987 -> 1988 -> 1989
-> {1990 [shape=plaintext, fontsize=26]} -> 1991 -> 1992 -> 1993 
-> 1994 -> 1995 -> 1996 
-> 1997 -> 1998 -> 1999
-> {2000 [shape=plaintext, fontsize=26]} -> 2001 -> 2002 
-> 2003 -> 2004
-> 2005 -> 2006 -> 2007
-> {2008 [shape=plaintext, fontsize=26]}
}

node [shape=box];
{ rank=source; past; "Obragas"; "Haarlemmermeer"; "NRE"; "SEP"; "EZH"; "GEB Den Haag"; "GEB Dordrecht"; "GEB Rotterdam"; "Vlaardingen/Maassluis"; "ERL"; "Delfland" ; "Weert"; "EMH"; "GZO"; "GMK"; "EZK"; "GNOF"; "Amstelland"; "ONS"; "GCN"; "PUEM"; "GEB Utrecht"; "PEGUS"; "PEN"; "GEB Amsterdam"; "GKNH"; "EZW"; "GEB Haarlem"; "REGEV"; "GAMOG"; "GGR"; "EWR"; "Centraal Overijssel"; "RENDO"; "VNB"; "ZGN"; "PEB Friesland"; "PGEM"; "EGD"; "Ijsselmij"; "Salland"; "GAZO"; "Frigem"; "Westergo"; "Westland"; "Maastricht"; "Heerlen"; "Limagas" ; "PLEM"; "RNH"; "PNEM"; "PZEM"; "Intergas"}

{ rank=same; 1987; "REMU"; "EPON"; "EPZ"}

{ rank=same; 1988; "EZH_1988" [label="EZH"]; "UNA"}

{ rank=same; 1991; "DELTA" [label="DELTA"]}

{ rank=same; 1992; "Ijsselmij_1992" [label="Ijsselmij"];
"MEGA"}

{ rank=min; 1993; "NUON_1993" [label="NUON"];
"EDON";
"PNEM"}

{ rank=same; 1994; "NUON_1994" [label="NUON"]}

{ rank=same; 1995; "ENECO_1995" [label="ENECO"];
"ENW"}

{ rank=same; 1997; "PNEM/MEGA"}

{ rank=same; 1998; "TenneT_1998" [label="TenneT"]; 
"ENW_1998" [label="ENW"];
"EDON_1998" [label="EDON"];

}

{ rank=same; 1999; "TZH_1999" [label="TZH"]; 
"Preussen_1999" [label="Preussen\nElektra"];
"REMU_1999" [label="REMU"];
"Electrabel";
"Essent_1999" [label="Essent"];
"NUON_1999" [label="NUON"];
}

{ rank=same; 2000; "RWE_2000" [label="RWE"]; "E.On_2000" [label="E.On"];
"ENECO_2000" [label="ENECO"];
"Reliant" [label="Reliant Energy"];
"Essent_2000" [label="Essent"]}

{ rank=same; 2003; "ENECO_2003" [label="ENECO"];
"NUON_2003" [label="NUON"];}

{ rank=same; 2005; "E.On_2005" [label="E.On"];
}

{ rank=same; 2006; "Electrabel_2006" [label="Electrabel"]}

{ rank=same; 2008; "RWE_2008" [label="RWE"]; "NRE/ObN-NetH"; 
"TenneT_2008" [label="TenneT"];
"E.On_2008" [label="E.On"];
"ENECO_2008" [label="ENECO"];
"Stedin_2008" [label="Stedin"];
"Liander_2008" [label="Liander"];
"NUON_2008" [label="NUON"];
"Cogas_2008" [label="Cogas"];
"RENDO_2008" [label="RENDO"];
"Electrabel_2008" [label="Electrabel"];
"Essent Netwerk_2008" [label="Essent Netwerk"];
"Essent_2008" [label="Essent"];
"EPZ_2008" [label="EPZ"];
"DELTA_2008" [label="Delta"];
"DELTA Netwerkbeheer_2008" [label="Delta\nNetwerkbeheer"];
"Intergas_2008" [label="Intergas"];
"DONG_2008" [label="DONG"];
}

//Splitsingspunten zonder naam
node [shape=point];
{ rank = same; 1997; "EDON_1997" [label=""];}
{ rank = same; 1998; "EZH_1998" [label=""]; 
"ENECO_1998" [label=""];
"PNEM/MEGA_1998" [label="PNEM/MEGA"]}
{ rank = same; 2000; "EPZ_2000" ;}
{ rank = same; 2001; "NUON_2001" ;}
{ rank = same; 2003; "TenneT_2003" [label=""];}
{ rank = same; 2005; "NRE_2005" [label=""];
"Intergas_2005" [label=""];
"Essent_2005" [label=""];}
{ rank = same; 2006; "Cogas_2006" [label=""];
"RENDO_2006"; "EN_2006"; "Essent_2006"}
{ rank = same; 2007; "RWE_2007" [label=""];
"ENECO_2007" [label=""];
"NUON_2007" [label=""];
"DELTA_2007" [label=""]}

/* Wellicht anders dan origineel 1 lijn voor combinatie levering/netbeheer */

/* Beheer van gas- en/of elektriciteitsnetten */
edge [color=blue];
"Obragas" -> "RWE_2000"
"Haarlemmermeer" -> "RWE_2000"
"RWE_2000" -> "RWE_2007"
"RWE_2007" -> "NRE/ObN-NetH"
"NRE" -> "NRE/ObN-NetH"
"EZH" -> "EZH_1988" [label="150 kV-net Zuid-Holland"]
"EZH_1988" -> "EZH_1998" -> "TZH_1999" -> "TenneT_2003"

//ENECO/Stedin
"GEB Den Haag" -> "ENECO_1995"
"GEB Dordrecht" -> "ENECO_1995"
"GEB Rotterdam" -> "ENECO_1995"
"Vlaardingen/Maassluis" -> "ENECO_1995"
"ERL" -> "ENECO_1998"
"ENECO_1995" -> "ENECO_1998" -> "ENECO_2000" -> "ENECO_2003" -> "ENECO_2007"
"ENECO_2007" -> "Stedin_2008"
"Delfland" -> "ENECO_2000"
"Weert" -> "ENECO_2000"
"EMH" -> "ENECO_2000"
"GZO" -> "ENECO_2000"
"GMK" -> "ENECO_2000"
"EZK" -> "ENECO_2000"
"GNOF" -> "ENECO_2000"
"Amstelland" -> "ENECO_2000"
"ONS" -> "ENECO_2007"
"GCN" -> "REMU_1999" 
"PUEM" -> "REMU"
"GEB Utrecht" -> "REMU" -> "REMU_1999" -> "ENECO_2003"

//NUON
"PEN" -> "ENW"
"GEB Amsterdam" -> "ENW"
"GKNH" -> "ENW"
"EZW" -> "ENW"
"GEB Haarlem" -> "ENW" -> "ENW_1998"
"REGEV" -> "ENW_1998" -> "NUON_1999"
"GAMOG" -> "NUON_1999"
"GGR" -> "NUON_2001" 
"EWR" -> "NUON_1999"
"VNB" -> "NUON_1994"
"ZGN" -> "NUON_1994"
"PEB Friesland" -> "NUON_1993"
"PGEM" -> "NUON_1993" -> "NUON_1994" -> "NUON_1999" -> "NUON_2001" -> "NUON_2003"
"NUON_2003" -> "NUON_2007" -> "Liander_2008"

//Overig
"Centraal Overijssel" -> "Cogas_2008"
"RENDO" -> "RENDO_2008"
"Intergas" -> "Intergas_2005" -> "Intergas_2008"
"PZEM" -> "DELTA" -> "DELTA_2007" -> "DELTA Netwerkbeheer_2008"

//RWE/Essent
"EGD" -> "EDON" -> "EDON_1997" -> "EDON_1998" -> "Essent_1999" -> "Essent_2000" 
"Essent_2000" -> "Essent_2005" -> "EN_2006" -> "Essent Netwerk_2008"
"Ijsselmij" -> "Ijsselmij_1992"
"Salland" -> "Ijsselmij_1992"
"GAZO" -> "Ijsselmij_1992" -> "EDON"
"Frigem" -> "EDON_1997"
"Westergo" -> "EDON_1998"
"Westland" -> "EN_2006"
"Maastricht" -> "Essent_2000"
"Heerlen" -> "PNEM/MEGA_1998" 
"Limagas" -> "MEGA"
"PLEM" -> "MEGA" -> "PNEM/MEGA" -> "PNEM/MEGA_1998" -> "Essent_1999"
"RNH" -> "PNEM_1993" -> "PNEM/MEGA"
"PNEM" -> "PNEM_1993"

edge [color=blue,style=bold];
"SEP" -> "TenneT_1998" [label="Landelijk koppelnet (220kV/380kV)"]
"TenneT_1998" -> "TenneT_2003" -> "TenneT_2008"

/* Levering (verkoop) van gas- en/of elektriciteit aan particulieren */
edge [color=green];
"Obragas" -> "RWE_2000"
"Haarlemmermeer" -> "RWE_2000"
"RWE_2000" -> "RWE_2007"
"RWE_2007" -> "RWE_2008"
"NRE" -> "NRE_2005" -> "E.On_2005"
"E.On_2005" -> "E.On_2008"

//ENECO/Stedin
"GEB Den Haag" -> "ENECO_1995"
"GEB Dordrecht" -> "ENECO_1995"
"GEB Rotterdam" -> "ENECO_1995"
"Vlaardingen/Maassluis" -> "ENECO_1995"
"ERL" -> "ENECO_1998"
"ENECO_1995" -> "ENECO_1998" -> "ENECO_2000" -> "ENECO_2003" -> "ENECO_2007"
"ENECO_2007" -> "ENECO_2008"
"Delfland" -> "ENECO_2000"
"Weert" -> "ENECO_2000"
"EMH" -> "ENECO_2000"
"GZO" -> "ENECO_2000"
"GMK" -> "ENECO_2000"
"EZK" -> "ENECO_2000"
"GNOF" -> "ENECO_2000"
"Amstelland" -> "ENECO_2000"
"ONS" -> "ENECO_2007"
"GCN" -> "REMU_1999" 
"PUEM" -> "REMU"
"GEB Utrecht" -> "REMU" -> "REMU_1999" -> "ENECO_2003"

//NUON
"PEN" -> "ENW"
"GEB Amsterdam" -> "ENW"
"GKNH" -> "ENW"
"EZW" -> "ENW"
"GEB Haarlem" -> "ENW" -> "ENW_1998"
"REGEV" -> "ENW_1998" -> "NUON_1999"
"GAMOG" -> "NUON_1999"
"GGR" -> "NUON_2001" 
"EWR" -> "NUON_1999"
"VNB" -> "NUON_1994"
"ZGN" -> "NUON_1994"
"PEB Friesland" -> "NUON_1993"
"PGEM" -> "NUON_1993" -> "NUON_1994" -> "NUON_1999" -> "NUON_2001" -> "NUON_2003"
"NUON_2003" -> "NUON_2007" -> "NUON_2008"

//RWE/Essent
"EGD" -> "EDON" -> "EDON_1997" -> "EDON_1998" -> "Essent_1999" -> "Essent_2000" 
"Essent_2000" -> "Essent_2005" -> "Essent_2006"
"Ijsselmij" -> "Ijsselmij_1992"
"Salland" -> "Ijsselmij_1992"
"GAZO" -> "Ijsselmij_1992" -> "EDON"
"Frigem" -> "EDON_1997"
"Westergo" -> "EDON_1998"
"Westland" -> "Essent_2006" -> "Essent_2008"
"Maastricht" -> "Essent_2000"
"Heerlen" -> "PNEM/MEGA_1998" 
"Limagas" -> "MEGA"
"PLEM" -> "MEGA" -> "PNEM/MEGA" -> "PNEM/MEGA_1998" -> "Essent_1999"
"RNH" -> "PNEM_1993" -> "PNEM/MEGA"
"PNEM" -> "PNEM_1993"

//Overig
"Centraal Overijssel" -> "Cogas_2006" -> "Electrabel_2006"
"RENDO" -> "RENDO_2006"  -> "Electrabel_2006" -> "Electrabel_2008"
"Intergas" -> "Intergas_2005" -> "DONG_2008"
"PZEM" -> "DELTA" -> "DELTA_2008"


/* Grootschalige productie van elektriciteit in Nederland */
edge [color=red];
"GEB Den Haag" -> "EZH_1988"
"GEB Dordrecht" -> "EZH_1988"
"GEB Rotterdam" -> "EZH_1988"
"EZH_1988" -> "EZH_1998" -> "Preussen_1999" -> "E.On_2000" -> "E.On_2005" -> "E.On_2008"
"PEGUS" -> "UNA" 
"PEN" -> "UNA"
"GEB Amsterdam" -> "UNA" -> "Reliant" -> "NUON_2003" -> "NUON_2007" -> "NUON_2008"

"PEB Friesland" -> "EPON" 
"PGEM"-> "EPON" 
"EGD"-> "EPON" 
"Ijsselmij"-> "EPON" -> "Electrabel" -> "Electrabel_2006" -> "Electrabel_2008"

"PLEM" -> "EPZ"
"RNH" -> "EPZ"
"PNEM" -> "EPZ"
"PZEM" -> "EPZ" -> "EPZ_2000" -> "EPZ_2008"
"EPZ_2000" -> "Essent_2000" [label="Centrales van N-Brabant \nen Limburg naar\nEssent"]
"Essent_2000" -> "Essent_2008"
}
1个回答

4

我发现可以通过替换以下内容来解决问题:

{ rank=min; 1993; "NUON_1993" [label="NUON"];
"EDON";
"PNEM"}

... with:

{ rank=same; 1993; "NUON_1993" [label="NUON"];
"EDON";
"PNEM_1993" [label="PNEM"]}

看起来是因为PNEMPast的排名相同,所以在与PNEM一起使用rank=min后,将1993移回与Past相同的等级。


很好发现!我找不到那个。 - SSteve

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接