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

2

16

I am trying to find out how can I strike-through some text in my nodes in dot based graphviz diagrams?

I checked out on this page, but couldn't figure out: http://www.graphviz.org/doc/info/attrs.html

Googling around didn't help as well.

Consider this diagram, these are basically bug numbers from a bugzilla. The red nodes represent closed bugs, but I do not want to color code them like this. Obviously striken-through 511272 is more intuitive than a red colored node 511272.

enter image description here

If anyone knows how to strike-through text inside nodes, please share. thanks,

Shobhit

Liquidambar answered 6/8, 2012 at 18:24 Comment(0)
S
17

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

Sinfonia answered 19/8, 2012 at 18:44 Comment(2)
Oh man, the answer was right there in front of me, but I didn't see it. You are awesome! Thanks, this solved my problem I have been stuck with since last week. Accepting your answer.Liquidambar
Here is a good web app for generating these strikethrough characters with three different formats: yaytext.com/strikeSosa
E
5

Aother option is to use HTML-like labels:

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

enter image description here

Ellsworthellwood answered 19/6, 2020 at 10:40 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.