How to create a new node type?

I consider to create this kind of node type within Graphviz.

I would like to have:

  • a type label with a dedicated colour (here “Step” with green color) and/or
  • inclusion of icons (e.g. SVG)

What would be the necessary steps I would need to follow to give such an attempt a chance?

Many thanks in advance!

I believe that record-style labels fail in two ways:

  • no embedded images
  • no multi-color nodes.

Html-like labels get much closer.

  • background colors work fine
  • rounded edges work in theory, but had problems with background colors
  • images can be embedded - in a separate cell
  • image sizing can be a problem It is probably best to explicitly size/resize the image outside of Graphviz and not mess with fixedsize, height and width.
  • needs some work on the edges
digraph i{
  n1 [shape=plaintext,label=<
  <TABLE CELLSPACING="0" CELLPADDING="0" BORDER="1" cellborder="0"> 
  <TR><TD colspan="1" bgcolor="green1">Step</TD></TR>
  <TR><TD>some text</TD></TR>

  n2 [shape=plaintext,label=<
  <TABLE CELLSPACING="0" CELLPADDING="0" BORDER="1" cellborder="0" >
  <TR><TD colspan="2" bgcolor="green1">Step</TD></TR>
  <TR><TD FIXEDSIZE="true" height="20" width="20"><IMG  SRC="cow.png" scale="true"/></TD><TD>some text</TD></TR>
  n1 -> n2


1 Like

Thanks Steve! This is a lot closer to what I was able to achieve. It looks good! I will use this. :slight_smile:

I thought that it is tricky to do it with the current abilities. I was therefore looking for guidance to do some coding. If I/anyone would want to extend the Graphviz code for a new type of node then what do I need to consider? is there any documentation on this?

I see that my question doesn’t fully show my intention.

Thanks for providing me this.

See this: FAQ | Graphviz
Any general-purpose or even kind-of general purpose additions would be great.
However, before you get into the guts of the code, consider these possibilities:

1 Like

Great resources. Thank you! I will need to play around with these possibilities.