I am trying to fruitlessly trying to figure out how I can left-justify my edge labels in graphviz. If anyone has a solution please help!
I have created a dataset to map object dependencies--then reading into graphviz via iterrows.
Here is my Python code that works--but renders my edge labels with text that is centre justified:
u = Digraph('unix',
filename='unix.gv',
node_attr={'color': 'lightblue',
'style': 'filled',
'fontname':'arial',
'shape':'box'},
edge_attr={'dir':'back',
'fontname':'arial',
'fontsize':'12'})
u.attr(size='20,20')
for index, row in d.iterrows():
u.edge(row.var_target, row.var_source, label=str(row.bizlogic))
u
If you replace the \n at the end of each line with a \l (for left justify) you should get the desired output (https://www.graphviz.org/doc/info/attrs.html#k:escString). An example (in straight Graphviz):
digraph G {
rankdir=LR;
a [ label ="Graphs can\lbe fun\l"];
b [ label ="left\lmiddle\nright\r " ];
a -> b [label ="Edges can\lalso\rbe fun\lI'm told\r"];
}
Giving: