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

Home » Public Forums » archive » Re: Color data points by 3rd variable
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Color data points by 3rd variable [message #84080] Thu, 25 April 2013 07:51
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Morgan Silverman writes:

> Colors=BytScl(temp5) seems to work. That's a lot simpler than I was trying to make it. How would I display a colorbar the corresponds to Colors?

Uh, like this:

cgColorbar

Set the Range keyword so that it corresponds to your data range.

Cheers,

David



--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: Color data points by 3rd variable [message #84082 is a reply to message #84080] Thu, 25 April 2013 07:45 Go to previous message
morganlsilverman is currently offline  morganlsilverman
Messages: 46
Registered: February 2013
Member
Colors=BytScl(temp5) seems to work. That's a lot simpler than I was trying to make it. How would I display a colorbar the corresponds to Colors? Thanks.

Sincerely,
Morgan


On Thursday, April 25, 2013 10:15:49 AM UTC-4, David Fanning wrote:
> Morgan Silverman writes:
>
>
>
>> I'm plotting the latitude and longitude locations of the top 5% of my dataset. I want to color the locations of these data points by corresponding no2 values. I'm having a hard time figuring out how to set up the colorscale and colorbar correctly. I tried something along the lines of
>
>>
>
>> no2temp = no2sorted(0:83) ; only want top 5% of data points (83 values out of 1661)
>
>> NO2colors = no2temp
>
>> NO2colors(*) = 0
>
>> NO2colors = fix(no2temp*255/(max(no2temp)-min(no2temp)))
>
>> cgcolors = cgColor(Bindgen(256))
>
>> NO2colors = cgcolors[NO2colors]
>
>>
>
>> but it doesn't seem to work quite right. I'd like the range to be [1e16, 4e16]. Looking for any insight. Thanks.
>
>
>
> It isn't clear to me if you are plotting *all* the data, but only the
>
> top five percent is colored, of if you just want to plot the top five
>
> percent and you want the data colored. If you want the latter, and
>
> assuming your variables are lon, lat, and temps, I would do it like
>
> this:
>
>
>
> cutoff95 = Max(temps) * 0.95
>
> indices = Where(temps GE cutoff95)
>
> lon5 = lon[indices]
>
> lat5 = lat[indices]
>
> temp5 = temps[indices]
>
> colors = BytScl(temp5)
>
> cgPlotS, lon5, lat5, Color=colors
>
>
>
> I may have the cutoff wrong. I'm really not clear what the "top 5% of my
>
> dataset" means. :-)
>
>
>
> Cheers,
>
>
>
> David
>
>
>
> --
>
> David Fanning, Ph.D.
>
> Fanning Software Consulting, Inc.
>
> Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
>
> Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: Color data points by 3rd variable [message #84084 is a reply to message #84082] Thu, 25 April 2013 07:37 Go to previous message
morganlsilverman is currently offline  morganlsilverman
Messages: 46
Registered: February 2013
Member
On Thursday, April 25, 2013 10:15:49 AM UTC-4, David Fanning wrote:
> Morgan Silverman writes:
>
>
>
>> I'm plotting the latitude and longitude locations of the top 5% of my dataset. I want to color the locations of these data points by corresponding no2 values. I'm having a hard time figuring out how to set up the colorscale and colorbar correctly. I tried something along the lines of
>
>>
>
>> no2temp = no2sorted(0:83) ; only want top 5% of data points (83 values out of 1661)
>
>> NO2colors = no2temp
>
>> NO2colors(*) = 0
>
>> NO2colors = fix(no2temp*255/(max(no2temp)-min(no2temp)))
>
>> cgcolors = cgColor(Bindgen(256))
>
>> NO2colors = cgcolors[NO2colors]
>
>>
>
>> but it doesn't seem to work quite right. I'd like the range to be [1e16, 4e16]. Looking for any insight. Thanks.
>
>
>
> It isn't clear to me if you are plotting *all* the data, but only the
>
> top five percent is colored, of if you just want to plot the top five
>
> percent and you want the data colored. If you want the latter, and
>
> assuming your variables are lon, lat, and temps, I would do it like
>
> this:
>
>
>
> cutoff95 = Max(temps) * 0.95
>
> indices = Where(temps GE cutoff95)
>
> lon5 = lon[indices]
>
> lat5 = lat[indices]
>
> temp5 = temps[indices]
>
> colors = BytScl(temp5)
>
> cgPlotS, lon5, lat5, Color=colors
>
>
>
> I may have the cutoff wrong. I'm really not clear what the "top 5% of my
>
> dataset" means. :-)
>
>
>
> Cheers,
>
>
>
> David
>
>
>
> --
>
> David Fanning, Ph.D.
>
> Fanning Software Consulting, Inc.
>
> Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
>
> Sepore ma de ni thue. ("Perhaps thou speakest truth.")

David,

Thanks for responding. To clarify, it is the latter. I want to plot only the outliers of high values in my dataset and color those. I tried to sort the data and select only the values that were within the highest 5% of all values. I'm not sure I calculated that correctly either.

-Morgan
Re: Color data points by 3rd variable [message #84085 is a reply to message #84084] Thu, 25 April 2013 07:15 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Morgan Silverman writes:

> I'm plotting the latitude and longitude locations of the top 5% of my dataset. I want to color the locations of these data points by corresponding no2 values. I'm having a hard time figuring out how to set up the colorscale and colorbar correctly. I tried something along the lines of
>
> no2temp = no2sorted(0:83) ; only want top 5% of data points (83 values out of 1661)
> NO2colors = no2temp
> NO2colors(*) = 0
> NO2colors = fix(no2temp*255/(max(no2temp)-min(no2temp)))
> cgcolors = cgColor(Bindgen(256))
> NO2colors = cgcolors[NO2colors]
>
> but it doesn't seem to work quite right. I'd like the range to be [1e16, 4e16]. Looking for any insight. Thanks.

It isn't clear to me if you are plotting *all* the data, but only the
top five percent is colored, of if you just want to plot the top five
percent and you want the data colored. If you want the latter, and
assuming your variables are lon, lat, and temps, I would do it like
this:

cutoff95 = Max(temps) * 0.95
indices = Where(temps GE cutoff95)
lon5 = lon[indices]
lat5 = lat[indices]
temp5 = temps[indices]
colors = BytScl(temp5)
cgPlotS, lon5, lat5, Color=colors

I may have the cutoff wrong. I'm really not clear what the "top 5% of my
dataset" means. :-)

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Color data points by 3rd variable
Next Topic: Re: MAP_CONTINENTS,/HIRES does not match MAP_CONTINENTS,/HIRES,/USA

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

Current Time: Wed Oct 08 13:54:49 PDT 2025

Total time taken to generate the page: 0.00516 seconds