E
Edvard Majakari
Ok, not strictly Python related: I wonder if any of you graphical Python
folks have run accross some handy resource for the given topic.
The problem is that of producing histograms, where n distinct items can be
plotted simultaneously. However, when n goes over 6 it is not very easy to
make up colors that are easily distinguishable from each other. So, now
I'm thinking of two alternatives:
1. Create an algorithm distinct_colors(n, bg), which produces n-1 as
distinct colors as possible (where bg is one of the colors) and returns
those colors in RGB color model as tuple of decimals (r, g, b).
Eg. distinct_colors(4, (255, 255, 255)) would return
((255, 0, 0), (0, 255, 0), (0, 0, 255))
assuming that "pure-rgb" red, green and blue are visually the three as
distinct colors as possible from white.
2. Find a color palette containing say, 8 or 10 colors as visually far apart
from each other as possible
The first one would be more nice, but I doubt I can produce it myself
without any knowledge of psychology and physics related to phenomenon.
Using google it seemed like there's demand for the algorithm. I'll
probably publish the code in Python Cookbook or similar if I end up with
something nice.
--
# Edvard Majakari Software Engineer
# PGP PUBLIC KEY available Soli Deo Gloria!
One day, when he was naughty, Mr Bunnsy looked over the hedge into Farmer
Fred's field and it was full of fresh green lettuces. Mr Bunnsy, however, was
not full of lettuces. This did not seem fair. --Mr Bunnsy has an adventure
folks have run accross some handy resource for the given topic.
The problem is that of producing histograms, where n distinct items can be
plotted simultaneously. However, when n goes over 6 it is not very easy to
make up colors that are easily distinguishable from each other. So, now
I'm thinking of two alternatives:
1. Create an algorithm distinct_colors(n, bg), which produces n-1 as
distinct colors as possible (where bg is one of the colors) and returns
those colors in RGB color model as tuple of decimals (r, g, b).
Eg. distinct_colors(4, (255, 255, 255)) would return
((255, 0, 0), (0, 255, 0), (0, 0, 255))
assuming that "pure-rgb" red, green and blue are visually the three as
distinct colors as possible from white.
2. Find a color palette containing say, 8 or 10 colors as visually far apart
from each other as possible
The first one would be more nice, but I doubt I can produce it myself
without any knowledge of psychology and physics related to phenomenon.
Using google it seemed like there's demand for the algorithm. I'll
probably publish the code in Python Cookbook or similar if I end up with
something nice.
--
# Edvard Majakari Software Engineer
# PGP PUBLIC KEY available Soli Deo Gloria!
One day, when he was naughty, Mr Bunnsy looked over the hedge into Farmer
Fred's field and it was full of fresh green lettuces. Mr Bunnsy, however, was
not full of lettuces. This did not seem fair. --Mr Bunnsy has an adventure