How to strike-through text in dot language (graphviz)

Aother option is to use HTML-like labels:

digraph G {
    a [label=<<s>12345</s>>]
    b [label="54321"]
    a->b
}

enter image description here


Graphviz does not have a styling of its own to do this, but since it is Unicode you can use the technique with combining characters and "combining long stroke overlay" (U+0336) that the wikipedia article on strikethrough suggests:

In plain text scenarios where markup cannot be used, Unicode offers a number of combining characters that achieve similar effects. The "long stroke overlay" (U+0336) results in an unbroken stroke across the text,

  • Separate: A̶B̶C̶D̶E̶F̶G̶H̶I̶
  • Combined: A̶B̶C̶D̶E̶F̶G̶H̶I̶

This graph:

digraph G {
    a [label="1̶2̶3̶4̶5̶"]
    b [label="54321"]
    a->b
}

Renders this png output with graphviz 2.23.6:

graphviz example with unicode strikethrough

Tags:

Graphviz

Dot