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

Home » Public Forums » archive » Color Data with Colorbar OOB Colors
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
Color Data with Colorbar OOB Colors [message #86785] Tue, 03 December 2013 12:01 Go to next message
morganlsilverman is currently offline  morganlsilverman
Messages: 46
Registered: February 2013
Member
Hello,

I'm trying to color a selection of the data I've plotted but am having a hard time getting the color bar and data colors to match correctly. I've plotted data that has altitudes from 0-5 km but only want to have a range of colors from 0-2 km and have everything above 2 km the same last color bar value (color 256). I've created a color bar with 256 colors from 0-2, but I can't seem to get this to match the colors of the data in the figure. Any suggestions. Thank you.

Sincerely,
Morgan
Re: Color Data with Colorbar OOB Colors [message #86786 is a reply to message #86785] Tue, 03 December 2013 14:19 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Morgan Silverman writes:

> I'm trying to color a selection of the data I've plotted but am having a hard time getting the color bar and data colors to match correctly. I've plotted data that has altitudes from 0-5 km but only want to have a range of colors from 0-2 km and have everything above 2 km the same last color bar value (color 256). I've created a color bar with 256 colors from 0-2, but I can't seem to get this to match the colors of the data in the figure. Any suggestions

Are you by any chance talking about a filled contour plot? If so, have
you read this article?

http://www.idlcoyote.com/cg_tips/oobcontour.php

If not, maybe you could get us a better idea of what you are doing so we
would have basis for answering your question. :-)

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 with Colorbar OOB Colors [message #86787 is a reply to message #86786] Tue, 03 December 2013 16:17 Go to previous messageGo to next message
morganlsilverman is currently offline  morganlsilverman
Messages: 46
Registered: February 2013
Member
On Tuesday, December 3, 2013 5:19:21 PM UTC-5, David Fanning wrote:
> Morgan Silverman writes:
>
>
>
>> I'm trying to color a selection of the data I've plotted but am having a hard time getting the color bar and data colors to match correctly. I've plotted data that has altitudes from 0-5 km but only want to have a range of colors from 0-2 km and have everything above 2 km the same last color bar value (color 256). I've created a color bar with 256 colors from 0-2, but I can't seem to get this to match the colors of the data in the figure. Any suggestions
>
>
>
> Are you by any chance talking about a filled contour plot? If so, have
>
> you read this article?
>
>
>
> http://www.idlcoyote.com/cg_tips/oobcontour.php
>
>
>
> If not, maybe you could get us a better idea of what you are doing so we
>
> would have basis for answering your question. :-)
>
>
>
> 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.")

I apologize for not being clear. No this is not a contour plot. I am plotting individual latitude vs longitude points as symbols. I want each of those points colored by the corresponding altitude but only colored up to 2 km, above they should all be the same color. I still need to be able to see all points though. When I tried to limit, I also limit plotting the locations above 2 km. I've included a bit of plotting code. I hope this helps. Thank you.

loadct, 33
lonrange = [-77.75, -75.5] ; Flight 7,8,9,12,13,14
latrange=[38.25, 40] ; Flight 7,8,9,12,13,14
limit = [latrange(0),lonrange(0),latrange(1),lonrange(1)]
pp=[0.1,0.1,0.82,0.95]
colors=bytscl(DAQalt)
cgplot, DAQlon, DAQlat, /nodata, xstyle=1, ystyle=1, xrange=lonrange, yrange=latrange, position=pp,/noerase
position=pp,/noerase
cgMap_set, 38.25, -76.5, limit=limit, /lambert, /noerase, position=pp ;37,-76.35 for zoomed in...37.2, -76.7 zoomed out
cgMap_GSHHS, ShoreData, Fill=1, Level=3, Color='black', /Outline
cgplots, DAQlon, DAQlat, psym=2, color=colors
cgColorbar, divisions=4, range=[0,2], /Vertical, /right, charsize=1, position=[0.83,0.1,0.86,0.9]
Re: Color Data with Colorbar OOB Colors [message #86788 is a reply to message #86787] Tue, 03 December 2013 16:36 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Morgan Silverman writes:

> I apologize for not being clear. No this is not a contour plot. I am plotting individual latitude vs longitude points as symbols. I want each of those points colored by the corresponding altitude but only colored up to 2 km, above they should all be the same color. I still need to be able to see all points though. When I tried to limit, I also limit plotting the locations above 2 km. I've included a bit of plotting code. I hope this helps

I would do it like this:

DAQlon = cgScaleVector(Randomu(seed, 100), -75.5, -77.75)
DAQLat = cgScaleVector(Randomu(seed, 100), 38.25, 40.0)
DAQAlt = cgScaleVector(Randomu(seed, 100), 0.0, 3.0)
shoredata = 'gshhs_i.b'

tooHigh = Where(DAQAlt GT 2.0, count)
colors=bytscl(DAQalt, Top = 254)
IF count GT 0 THEN colors[tooHigh] = 255
cgLoadCT, 33, NColors=254
TVLCT, cgColor('charcoal', /Triple), 255

lonrange = [-77.75, -75.5] ; Flight 7,8,9,12,13,14
latrange=[38.25, 40] ; Flight 7,8,9,12,13,14
limit = [latrange(0),lonrange(0),latrange(1),lonrange(1)]
pp=[0.1,0.1,0.82,0.95]

cgplot, DAQlon, DAQlat, /nodata, xstyle=1, ystyle=1, $
xrange=lonrange, yrange=latrange, position=pp
cgMap_set, 38.25, -76.5, limit=limit, /lambert, $
/noerase, position=pp ;37,-76.35 for zoomed in...37.2, -76.7 zoomed
out
cgMap_GSHHS, ShoreData, Fill=1, Level=3, Color='black', /Outline
cgplots, DAQlon, DAQlat, psym=2, color=colors
cgColorbar, divisions=4, range=[0,2], /Vertical, /right, $
charsize=1, position=[0.83,0.1,0.86,0.9], NColors=254, $
OOB_High='charcoal'
END


--
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 with Colorbar OOB Colors [message #86789 is a reply to message #86788] Tue, 03 December 2013 16:49 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
David Fanning writes:

> I would do it like this:

I forgot to mention, I spent about a half hour working on this for you.

Total love for the week so far: $10.

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: Resample (neighborhood averaging) a 3D array with missing data
Next Topic: xmargin and ymargin keywords ignored in cgplot

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

Current Time: Wed Oct 08 09:20:34 PDT 2025

Total time taken to generate the page: 0.00532 seconds