How to do italic node labels with GraphViz dot?
Asked Answered
D

1

9

I'm trying to draw some graph using graphviz with dot. It works fine. However, I would like to set the font to italic for letters (a,b,c...). Here is my code:

digraph mygraph{
  node [shape=plaintext]
 "Ø" -> "{a}" 
 "Ø" -> "{b}" 
 "Ø" -> "{c}"
 "Ø" -> "{d}"
}

What should I do so that 'a' 'b' 'c' and 'd' would be in italics but not the '{' and '}'?

Dicephalous answered 29/6, 2015 at 16:49 Comment(0)
Y
12

You may try using the syntax for Html-like labels and first define the node a with a label attribute:

a [label=<{<I>a</I>}>]
"Ø" -> a
Yetta answered 29/6, 2015 at 20:57 Comment(3)
Thanks but by doing this, the {a} is shown as an edge label rather than a node label. I want the node label to be in italicsDicephalous
You're right of course, I fixed the example - you'll have to first define the node with its attributes, and then define the edges.Yetta
When used in this way with shape = circle, the circle becomes an ellipse, and the double circle does not appear. This code: q0 [label=<<I>q</I>0>], node [shape = doublecircle]; q0;, node [shape = circle]; qi -> q0; q0 -> q0 [ label = "b" ]; does paint ellipses. Why is it so?Multifarious

© 2022 - 2024 — McMap. All rights reserved.