I'm using the Python graphviz library and my nodes are formatted with HTML.
My python code generates this node:
MyNode [label=<{Topic|<b>SubHeader</b>|field1: int<BR/>fields: dict<BR/>}>]
I want to left align the text on the last (fields) section.
How do I add alignment instructions only for the last section?
Graphviz supports adding \l
as a justification escape code, but it does not seem to work for HTML formatted nodes.
Similarly, I cannot figure out how to add <p>
tags to the HTML code.
<BR ALIGN="LEFT"/>
is legal. so:graph {
node [shape=Mrecord]
MyNode [label=<{Topic|<b>SubHeader</b>|field1: int<BR ALIGN="LEFT"/>fields: dict<BR ALIGN="LEFT"/>}>]
}
ps <P>
is not legal Graphviz syntax. See https://graphviz.org/doc/info/shapes.html (Graphviz uses HTML-like syntax. Emphasis on -like )
pps Consider using actual HTML-like records. They give more control.
3 versions, 2 using html-like records:
graph {
node [shape=Mrecord]
MyNode [label=<{Topic|<b>SubHeader</b>|field1: int<BR ALIGN="LEFT"/>fields: dict<BR ALIGN="LEFT"/>}>]
node [shape=plaintext]
MyNodeA [label=<<table style="rounded">
<tr><td border="0">Topic</td></tr>
<hr/>
<tr><td border="0"><b>SubHeader</b></td></tr>
<hr/>
<tr><td border="0" align="left">field1: int</td></tr>
<tr><td border="0" align="left">fields: dict</td></tr>
</table>>]
MyNodeB [label=<<table style="rounded">
<tr><td border="0">Topic</td></tr>
<hr/>
<tr><td border="0"><b>SubHeader</b></td></tr>
<hr/>
<tr><td border="0" align="left" balign="left">field1: int<br/>fields: dict</td></tr>
</table>>]
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.