Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #27576

Re: color coding for numbers

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail
From DJC <djc@news.invalid>
Newsgroups comp.lang.python
Subject Re: color coding for numbers
Date Tue, 21 Aug 2012 19:07:04 +0200
Organization qwpynex
Lines 56
Message-ID <k10f7r$ig0$1@dont-email.me> (permalink)
References <57f81534-03af-475f-91c1-aee554e71ab6@googlegroups.com> <d16cg9-7kq.ln1@satorlaser.homedns.org>
Reply-To nntp-e@djclark.eu
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding 7bit
Injection-Date Tue, 21 Aug 2012 17:07:09 +0000 (UTC)
Injection-Info mx04.eternal-september.org; posting-host="62f27c1369b8d5f4d7b581750181d248"; logging-data="18944"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX186ZTdBm5B6sMR1DykXyrFk"
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120714 Thunderbird/14.0
In-Reply-To <d16cg9-7kq.ln1@satorlaser.homedns.org>
Cancel-Lock sha1:9OukJBG55OMooj+5Po1XNOmsZoQ=
Xref csiph.com comp.lang.python:27576

Show key headers only | View raw


On 21/08/12 12:55, Ulrich Eckhardt wrote:
> Am 21.08.2012 10:38, schrieb namenobodywants@gmail.com:
>> what is the best way
>
> Define "best" before asking such questions. ;)


<http://matplotlib.sourceforge.net/api/colors_api.html?highlight=colors#matplotlib.colors>
matplotlib.colors

A module for converting numbers or color arguments to RGB or RGBA

RGB and RGBA are sequences of, respectively, 3 or 4 floats in the range 0-1.

This module includes functions and classes for color specification 
conversions, and for mapping numbers to colors in a 1-D array of colors 
called a colormap.

see
<http://matplotlib.sourceforge.net/examples/pylab_examples/colours.html?highlight=colours>



>
>
>> 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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

color coding for numbers namenobodywants@gmail.com - 2012-08-21 01:38 -0700
  Re: color coding for numbers Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> - 2012-08-21 12:55 +0200
    Re: color coding for numbers DJC <djc@news.invalid> - 2012-08-21 19:07 +0200
      Re: color coding for numbers Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> - 2012-08-22 12:56 +0200
  Re: color coding for numbers Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-08-21 13:48 -0400

csiph-web