comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: colorbar question
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: colorbar question [message #79891 is a reply to message #79889] Tue, 17 April 2012 11:00 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
zolile mtumela writes:

> My problem is that, we have values between(1 to 5 mHz) lets say
> (2.1, 2.3,2.5,2.9,3.3,4.2,..)that correspond to these cities/mag
> stations. Each and every city has their value. I want a different
> color for each city and display that color at the color with their
> value. With xyouts,...,color=220, displays one color in all cities on
> the map. I want different for these cities and also represent using
> color bar.

Yes. Color 220 is a *particular* color in the color table. It is
always the *same* color! Suppose your city colors range from 1.1 to 5.8.
You could scale these colors into the 256 values of the color table
by doing something like this:

minCityClr = 1.1
maxCityClr = 5.8
XYOuts, ..., Color=BytScl(cityColor, MIN=minCityClr, MAX=maxCityClr)

Now, your colors will look something like this:

Print, BytScl(2.1, MIN=minCityClr, MAX=maxCityClr)
54
Print, BytScl(2.3, MIN=minCityClr, MAX=maxCityClr)
65
Print, BytScl(2.5, MIN=minCityClr, MAX=maxCityClr)
76

This way, you are at the mercy of your color table. So
I wouldn't do it this way. I would probably just make
a vector of colors with the right number of colors:

cityColors = ['red', 'green', 'purple', ...]

And do it in a loop:

FOR j=0,numCities-1 DO cgText, city_lon[j], city_lat[j], $
city_name[j], Color=cityColors[j]

And, yeah, I'd be using Coyote Graphics routines. :-)

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: SVDC for EOF analysis of time series data
Next Topic: Re: Ice and Wind: Standing on the Arctic Ocean

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 19:53:44 PDT 2025

Total time taken to generate the page: 0.00435 seconds