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 
Return to the default flat view Create a new topic Submit Reply
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.")
[Message index]
 
Read Message
Read Message
Read Message
Read Message
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: Thu Oct 09 14:51:42 PDT 2025

Total time taken to generate the page: 0.72309 seconds