Two colors in one node with a graph point?

I am wondering if node can be divided into two different colors. I am using graphviz dot (http://www.graphviz.org/).

Perhaps a vertical or diagonal line can divide the node into two colors. I want to do this because I have many nodes that belong to two different categories (colors) with some nodes belonging to both.

Thanks a lot James

+6
source share
3 answers

Gradient functionality was only added to Graphviz on January 26, 2012; until a new version of Graphviz is released, stable version 2.30.0, you need to download Graphviz development version 2.29.20120127.05.0545 or later.

In addition, gradients are apparently only implemented for the Cairo / Pango renderer; in my tests, Quartz (Mac) and GD renderers revert to using only the first color. In particular, this means that if you are working on a Mac and using the graphical viewer Graphviz.app, you will not see gradients yet.

digraph G { Gradient [style="filled", fillcolor="orange:yellow"] } 

enter image description here

+9
source

I do not think there is a ready-made solution to have 2 background colors.

The best solution would be to use the fill gradient ( fillcolor="orange:yellow" ) - but although this is the documentation, I could not get it to work on my box.

You can use HTML-like tags as a workaround. You may need to split the label so that it is centered, depending on your needs:

 a[shape="none", label=< <table cellpadding="0" cellborder="0" cellspacing="0" border="0"> <tr> <td bgcolor="orange">abc</td> <td bgcolor="yellow">def</td> </tr> </table> >] 

2 colors

+3
source

Perhaps if you use the image attribute of the label and provide a suitable background image:

 digraph G { i1 [shape=none, image="range.png", label=""]; i2 [shape=none, image="range.png", label="Image w label", imagescale=true]; i1 -> i2; } 

This gives the following result:

enter image description here

using the range.png file

enter image description here

0
source

Source: https://habr.com/ru/post/906982/


All Articles