I want to use graphviz to visualize tables. In graphviz, a row corresponds to the tags:
<TR>
</TR>
and a column syntax is:
<TD></TD>
The leftmost column syntax is :
<TD>value</TD>
and the right column syntax is :
<TD PORT="b1">value</TD>
to allow links between the different row tables.
Is there a way to convert a dataframe to this syntax ?
blue_crosses <- c("B1", "B2", "B3")
squares <-c("Left", "Left", "Right")
set1 <- as.data.frame(blue_crosses, squares)
digraph G
{
node[ shape = none, fontname = "Arial" ];
set1[ label=<
<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="4">
<TR>
<TD>Blue Crosses</TD>
<TD>Square</TD>
</TR>
<TR>
<TD>B1</TD>
<TD PORT="b1">Left</TD>
</TR>
<TR>
<TD>B2</TD>
<TD PORT="b2">Left</TD>
</TR>
<TR>
<TD>B3</TD>
<TD PORT="b3">Right</TD>
</TR>
</TABLE>>];
set2[ label=<
<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="4">
<TR>
<TD>Blue Crosses</TD>
<TD>Coordinates</TD>
</TR>
<TR>
<TD PORT="b1">B1</TD>
<TD>(1, 1)</TD>
</TR>
<TR>
<TD PORT="b2">B2</TD>
<TD>(2, 2)</TD>
</TR>
<TR>
<TD PORT="b3">B3</TD>
<TD>(4, 2)</TD>
</TR>
</TABLE>>];
# layout
nodesep = 2; /* increase distance between nodes */
{ rank = same; set1 set2 }
set1:b1 -> set2:b1;
set1:b2 -> set2:b2;
set1:b3 -> set2:b3;
}