Hello…
Long time user of pygraphviz. I’m drawing directed edges between two nodes with a two color color list like dir=both, color=‘orange:black’. This displays a line with arrowheads on both ends. Perfect. It seems like one of the colors is about 90%+ of with width of the edge itself. In this example I added the penwidth=10 parameter to make the edge fat and you can see that the line is mostly black with only a thin stripe of orange.
I tried changing the colorlist to add fractions like this: color=‘orange;0.90:black’ but it didn’t see to do much
How do I get a roughly 50/50 thickness of the two colors?
I’m using prog=‘neato’ and format=‘svg’ in case that matters. I think pygraphviz is 1.5.
Thanks in advance!
Ed
Can you produce a “dot” output & share it?
Hi Steve,
Thanks for your reply… Never looked at it in dot before but here is the edge in question. I assume you didn’t want then entire graph since it’s pretty large:
“switchS2B510x7c0187fc1/22” [height=0.5,
label=“0x7c0187+ 2 others”,
len=2.0,
pos=“1316.1,1125.4”,
shape=oval,
style=dashed,
width=2.4444];
switchS2B – “switchS2B510x7c0187fc1/22” [key=“switchS2B%fc1/22%switchS2B510x7c0187fc1/22”,
arrowsize=1.5,
color=“#ffa500:#000000”,
dir=both,
label=“fc1/22 (32G)”,
len=2.5,
lp=“1266,1015.3”,
penwidth=10,
pos=“s,1290.8,906.7 e,1314,1107.2 1293.4,928.87 1299.1,978.58 1306.6,1043.5 1311.4,1084.9”];
I just set the colors with color=“#ffa500:#000000”, The black part of the edge is much thicker than the orange part. The black and orange arrowheads look fine though.
Thanks for your help.
Ed
For future reference, The text above now includes non-ascii characters (e.g. the double-quotes). Please embed copy/paste source within 3 backticks.
Hi Steve,
OK I guess. Are you asking me to do something?
Thanks,
Ed
colorlist is poorly documented and works non-intuitively for edges.
- each color in a list defines 1 “unit” (my term) of linear color (point/width). If the penwidth value is greater than the number of colors (true in your example), then the last color is used for the rest of the penwidth. Restated in English: your penwidth is 10, so 1/10 of the width is given to the 1st color and 9/10 is given to the 2nd color. What you seem to want is
color="#ffa500:#ffa500:#ffa500:#ffa500:#ffa500:#000000"
- the fraction option in a colorlist defines a fraction of the length, not the width! This allows changing colors along the length of an edge. Handy, but not what you are trying to do today.
Whew! I learned something new today.
Hi Steve,
OK thanks a bunch! That’s a bit difficult to deal with I guess from a programming perspective. But I guess it is what it is. I did notice the percentages dealt with the length of the edges and not the width but I guess I was hoping there was some syntax to give me 50:50 fairly easily. I vary with penwidth on certain edges so I will have to include some logic to repeat the colors as well (or at least the initial color).
Thanks!! Much much appreciated!
Ed
1 Like