Re: colorbar question [message #79879] |
Wed, 18 April 2012 05:13  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
zolile mtumela writes:
> So far I managed to use different colors for these cities, now I am
> studying about colorbar so that I can use these color city there!!
If you don't have too many cities, I would use the discrete
color bar, cgDCBar, to label these colors. You could also
use the DISCRETE keyword with cgColorbar, but this is
better for labeling a range of values as a particular
color.
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.")
|
|
|
|
|
Re: colorbar question [message #79889 is a reply to message #79888] |
Tue, 17 April 2012 11:29   |
zolile mtumela
Messages: 50 Registered: September 2011
|
Member |
|
|
On Apr 17, 8:00 pm, David Fanning <n...@idlcoyote.com> wrote:
> 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.")
Thank you a lot. I will study this program!!
|
|
|
Re: colorbar question [message #79891 is a reply to message #79889] |
Tue, 17 April 2012 11:00   |
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.")
|
|
|
Re: colorbar question [message #79892 is a reply to message #79891] |
Tue, 17 April 2012 10:09   |
zolile mtumela
Messages: 50 Registered: September 2011
|
Member |
|
|
On Apr 17, 2:56 pm, David Fanning <n...@idlcoyote.com> wrote:
> zolile mtumela writes:
>> I am looking for help and advices. I am plotting map showing cities. I
>> would like put different colors in these cities that correspond with a
>> colorbar. The cities will have some values that should be display on
>> the colorbar. I red some staff on this but I am not winning, I spent
>> all most a half month trying this, Please help me.
>> I will have some values like this NAQ=2.2, STF=1.4, etc
>
> You have been working on this for half a month, and it
> never once occurred to you to use a COLOR keyword
> on XYOUTS. Sigh... You must be a man of great
> faith, my friend!
>
> I would do a couple of things. First, I would give
> your color bar a range that wasn't zero, so it would
> actually appear on your display.
>
> Then, I would byte scale the values you plan to
> display in color.
>
> Finally, I would use a COLOR keyword to indicate
> which color you want to use when you write the
> city name.
>
> 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.")
Thank you!!
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.
please help
Thanks\
Zolile
|
|
|
Re: colorbar question [message #79895 is a reply to message #79892] |
Tue, 17 April 2012 05:56   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
zolile mtumela writes:
> I am looking for help and advices. I am plotting map showing cities. I
> would like put different colors in these cities that correspond with a
> colorbar. The cities will have some values that should be display on
> the colorbar. I red some staff on this but I am not winning, I spent
> all most a half month trying this, Please help me.
> I will have some values like this NAQ=2.2, STF=1.4, etc
You have been working on this for half a month, and it
never once occurred to you to use a COLOR keyword
on XYOUTS. Sigh... You must be a man of great
faith, my friend!
I would do a couple of things. First, I would give
your color bar a range that wasn't zero, so it would
actually appear on your display.
Then, I would byte scale the values you plan to
display in color.
Finally, I would use a COLOR keyword to indicate
which color you want to use when you write the
city name.
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.")
|
|
|
Re: colorbar question [message #79987 is a reply to message #79879] |
Thu, 19 April 2012 23:38   |
zolile mtumela
Messages: 50 Registered: September 2011
|
Member |
|
|
On Apr 18, 2:13 pm, David Fanning <n...@idlcoyote.com> wrote:
> zolile mtumela writes:
>> So far I managed to use different colors for these cities, now I am
>> studying about colorbar so that I can use these color city there!!
>
> If you don't have too many cities, I would use the discrete
> color bar, cgDCBar, to label these colors. You could also
> use the DISCRETE keyword with cgColorbar, but this is
> better for labeling a range of values as a particular
> color.
>
> 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.")
Thank you David again
I am getting there with your assistance, I used cgDCBar and lebels,
work very well.
many thanks
Zolile
|
|
|
Re: colorbar question [message #80112 is a reply to message #79987] |
Wed, 02 May 2012 06:43  |
zolile mtumela
Messages: 50 Registered: September 2011
|
Member |
|
|
On Apr 20, 8:38 am, zolile mtumela <zolilemtum...@gmail.com> wrote:
> On Apr 18, 2:13 pm, David Fanning <n...@idlcoyote.com> wrote:
>
>
>
>
>
>
>
>
>
>> zolile mtumela writes:
>>> So far I managed to use different colors for these cities, now I am
>>> studying about colorbar so that I can use these color city there!!
>
>> If you don't have too many cities, I would use the discrete
>> color bar, cgDCBar, to label these colors. You could also
>> use the DISCRETE keyword with cgColorbar, but this is
>> better for labeling a range of values as a particular
>> color.
>
>> 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.")
>
> Thank you David again
> I am getting there with your assistance, I used cgDCBar and lebels,
> work very well.
> many thanks
> Zolile
Hi David
I am looking for help and suggestions, in this program, i want to put
boxes next to these cities and these boxes must have different colors
as colorbar/cities.
There idea for this program is , I want to show two or more things/
values in one city, which will correspond with colorbar.
Your help is highly appreciated.
Many thanks
Zolile
|
|
|