I’m facing an issue with dynamically assigning colors to rows in my KNIME workflow. I have a table where the row names change dynamically, and I need to ensure each row is assigned a unique color automatically.
The problems I’m encountering with the Color Manager node are:
Fails with Changing Number of Rows: The node sometimes fails when the number of rows changes, especially if there are more rows than before.
Color Repetition: Even with 20 different categories, the Color Manager tends to repeat colors, which defeats the purpose of having distinct colors for each category.
Manually adjusting the colors every time the table content changes is not feasible. I’m looking for a way to automate this process, ensuring that:
• The Color Manager can handle dynamic row names and varying numbers of elements.
• Custom colors can be assigned automatically to each category.
• The Color Manager avoids repeating colors when there are enough colors available in the palette to assign unique colors to each category.
Is there a way to achieve this within KNIME, or perhaps an alternative method to prevent color repetition and handle dynamic changes effectively?
the color management in Knime certainly is improvable in many ways. I frequently face the challenge to consistently and dynamically manage colors in large workflows too. Just recently I had an idea and did a quick test.
With your post I took the change to create aa sample workflow that displays how manage colors in a more consistent manner throughout the workflow and in a dynamic fashion to
The following example workflow allows to:
Reintroduce colors if they got lost
Allows to save color data temporarily and load it dynamically elsewhere in the workflow
Reduced workflow complexity by not having to pass the color table down the workflow to merge it back with the data
Since I struggle a bit to imagine your workflow, do you mind to share it so we can combine yours and mine for a solid solution?
Also worth to note that I potentially discovered two bugs. I will create corresponding bug reports and link them here so you can vote for them to get fixed.
Edit: Here are the two bugs you might want to upvote too:
Inspired by your workflow, I modified it to use different colors using a Python script. This approach aims to provide better differentiation of colors by calculating the Euclidean distance in the CIELAB color space and ensuring maximal differentiation between interpolated colors. However, it remains quite cumbersome to have to input every single flow variable to define each color when dealing with multiple groups. This makes the process impractical for larger datasets.
A small modification to the Color Manager node would make it much more useful. For example, instead of requiring a flow variable for each color, it would be incredibly helpful if the node allowed for a list of colors to be input as a single flow variable. The node could then assign these colors sequentially. This would significantly simplify the process and make the node more user-friendly.
I really hope KNIME considers this change. The current setup generates a lot of trouble for users dealing with multiple groups. While the new representations and e-charts may alleviate some of these issues, updating the Color Manager node would still be beneficial for basic users and overall convenience. It would be great if someone could update this node to improve its functionality.
Here is the workflow in case someone is interested.
yes, we are aware of the limitations of the current Color Manager. It is great so see that you found a workaround, though we agree that this should be easier. Our plan is to improve the node when transitioning it to the modern user interface. It is rather high on the list, though it will still take some time.