Option coloured_edges is broken
mscfd opened this issue · comments
The option coloured_edges is broken. This is due to a wrong formatting of the rgb values. Here is the fixed code with {:02X} formatting in graphs.py:
def rainbowcolour(depth, maxd):
if not self.data.coloured_edges:
return "#000000"
(r, g, b) = colorsys.hsv_to_rgb(float(depth) / maxd, 1.0, 1.0)
rgb = [int(255 * r), int(255 * g), int(255 * b)]
return '#{:02X}{:02X}{:02X}'.format(*rgb)
After some playing with this option, I noted that some graphs tend to be rather red. This happens if there are some nesting levels with just one node. To still obtain colourful edges I added nesting level to the h-value as follows:
colour_h = (float(depth) / maxd - float(nesting-1.0)/7.0) % 1.0
(r, g, b) = colorsys.hsv_to_rgb(colour_h, 1.0, 1.0)
rgb = [int(255 * r), int(255 * g), int(255 * b)]
return '#{:02X}{:02X}{:02X}'.format(*rgb)
See commit 5505d26. This might or might not be useful for large graphs.