Reputation: 966
I have an unique problem. I am using dot to represent a graph which is generic in nature. So, instead of using numbers, I was planning to use symbols like greek letters like alpha, beta, etc. I am curious to know how can we label nodes/edges in .dot file using some symbols?
for example,
node1 -> node2 [label= <something here which will show up as symbol of beta> style=dashed]
Upvotes: 18
Views: 13576
Reputation: 382850
Unicode characters
Sometimes you can get away with Unicode https://en.wikipedia.org/wiki/Greek_alphabet#Greek_in_Unicode
graph {
"α" -- "β"
}
Output:
You can also emulate some more math with Unicode, e.g.:
Tested on Ubuntu 16.10, graphviz 2.38.
Upvotes: 4
Reputation: 13646
You can use HTML-like a labels:
digraph G {
a [ label=<α>]
b [ label=<β>]
c [ label=<γ>]
a -> b -> c
}
will show alpha -> beta -> gamma
:
You could also used named HTML references to make it even clearer (mentioned in a comment):
label=<I love α and β>
The surrounding <>
indicate that the label should be parsed as a custom language that looks like an HTML subset: http://www.graphviz.org/doc/info/lang.html#html
Upvotes: 25