2016-04-06 199 views
0

Okey如何在中间分割节点graphviz将节点分成不同颜色的两部分以及如何在多行文本中写入文本。Graphviz节点分割

我知道Graph viz是基于HTML的,但我无法做出任何解决方法我需要一些示例。

我想是这样的:

|------| 
|Title |<-- red background 
|------| 
|text1 | 
|text2 |<- green background 
|______| 

我的示例代码如下所示:提前

digraph G { 
    node [shape=box] <- don't know how to make it divided Up/Down parts 
    node1 {label = "Title"} 
    node2 [label = "text1\\text2"] <- Don't know what to do here 

    node1 -> node1 ; 
    node1 -> node2 ; 
} 

感谢。

回答

1

最有可能要使用HTML-like-labels

digraph structs { 
    node [shape=plaintext] 
    struct [label=< 
     <TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0"> 
      <TR><TD PORT="title" bgcolor="red">Title</TD></TR> 
      <TR><TD PORT="text" bgcolor="green">text1<br />text2</TD></TR> 
     </TABLE>>]; 
    // example edge 
    struct:title:w -> struct:text:s 
} 

enter image description here

0
digraph structs { 
node [shape=record style=filled]; 
nodesep=0; //minimize node separation; 
struct1 [label="Text1&#92;n Text2" color=green] 
struct2 [label="Title" color = red]; 
rankdir=LR; 

}

产生2 box colour img。任何人都知道是否可以从一边到另一边进行连接?