Search code examples
graphviz

Changing arrowhead color in graphviz


I want to make the tail of my arrow "#7a82de" while making the head black. Is it possible to achieve? I have read Graphviz documentation and searched on stackoverflow/google.

Thanks in advance.


Solution

  • Part of this can be achieved by color attribute for edge, but if you want to take the head of the arrow directly, you can only paint it by manually adjusting the digits, it is impossible to write something like arrowheadcolor=red. So you can use a very small number like 0.01 (meaning 1% of the arrow length) to indicate that only the arrow head needs to be painted in black.

    Script:

    digraph {
        A -> B [color="#7a82de:black;0.01"]
    }
    

    Result:
    enter image description here