16

I would like to change font attribute as the example below

example

Is there any way to change the font of just few words inside a label instead of using the global attribute change fontname="times bold italic" ? I need to convert to png.

Enrico Pirani
  • 1,387
  • 3
  • 13
  • 22

2 Answers2

38

You may use HTML-like labels in graphviz and define labels with partially bold text:

mynode [label=<<FONT FACE="boldfontname">bold text</FONT>>]

Or use the <B> tag:

mynode [label=< <B>bold text</B> regular text >]
marapet
  • 54,856
  • 12
  • 170
  • 184
  • 2
    Note the restriction ... "In addition, all of these markups are currently **only available via the cairo and svg** renderers." – cmcginty Sep 13 '17 at 03:55
  • @cmcginty The OP wanted to convert to png, cairo should work perfectly fine for this - a downvote seems a bit harsh ... – marapet Sep 14 '17 at 12:23
  • @marapet I tried to remove the downvote when I figured out why it wasn't working for me, but the time had expired. If you edit the answer then SO will let me remove it. – cmcginty Sep 14 '17 at 19:08
0

If you are really desperate, you could also copy&paste bold unicode strings into your graph description, for example using the following website:

https://lingojam.com/BoldTextGenerator

Apparently, this too does not work in all setups.

Radio Controlled
  • 825
  • 8
  • 23