Am 21.08.2012 10:38, schrieb namenobodywa...@gmail.com:
what is the best way
Define "best" before asking such questions. ;)
using color/shading on a tkinter canvas as a visualization for a
two-dimensional grid of numbers? so far my best idea is to use the
same value for R,G and B (fill = '#xyxyxy'), which gives shades of
gray. if possible i'd like to have a larger number of visually
distinct values.
The basic idea behind this is that you first normalize the values to a
value between zero and one and then use that to look up an according
color in an array. Of course you can also do both in one step or compute
the colors in the array on the fly (like you did), but it helps keeping
things simple at least for a start, and it also allows testing different
approaches separately.
If the different number of resulting colors isn't good enough then, it
could be that the array is too small (its size determines the maximum
number of different colours), that the normalization only uses a small
range between zero and one (reducing the effectively used number of
colours) or simply that your screen doesn't support that many different
colors.
> i've seen visualizations that seem to use some kind
> of hot-versus-cold color coding. does anybody know how to do this?
The colour-coding is just the way that above mentioned array is filled.
For the hot/cold coding, you could define a dark blue for low values and
a bright red for high values and then simply interpolate the RGB triple
for values in between.
Uli
--
http://mail.python.org/mailman/listinfo/python-list