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

Home » Public Forums » archive » Re: PlotS, Color
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: PlotS, Color [message #81602] Sat, 06 October 2012 17:08 Go to next message
robinson.inj is currently offline  robinson.inj
Messages: 32
Registered: August 2007
Member
On Saturday, October 6, 2012 10:07:56 AM UTC-4, (unknown) wrote:
> Hi all,
>
> I would like some help. I have this data
>
> 3 50 5
>
> 4 60 10
>
> 5 70 15
>
> 8 80 20
>
> 4 90 20
>
> 3 100 15
>
> 1 110 10
>
> The 2nd and 3rd cols are lon and lat. I need to plot a line conecting the values with especific colors. For instance from 3 to 4 in yellow, from 4 to 8 (and 8 to 4) in red, from 4 to 3 in yellow, and 3 to 1 in blue.
>
> Suggestions?
>
> Rob

Hi All, after Phillip's suggestion, I am doing this ( I am using David Fanning's IDL libraries, and IDL 6.3):

colors=['blue', 'green', 'yellow', 'gold', 'orange', 'brown', 'red', 'black']
levels = [0, 5, 8, 10, 15, 23, 30] ; color levels
s = Size(vals, /Dimensions)
TVLCT, cgColor(colors, /Triple), 1
scaleddata = BytArr(s[0])

FOR c=1,6 DO BEGIN
index = Where(vals GE levels[c-1] AND itcws LT levels[c], count)
IF count GT 0 THEN scaleddata[index] = Byte(c)
ENDFOR
index = Where(vals GT 30, count)
IF count GT 0 THEN scaledImage[index] = 7B
missing = Where(vals LT 0, missing_count)
IF missing_count GT 0 THEN scaleddata[missing] = 8B

FOR c=0,s-2 DO cgPlotS, [lons[c], lons[c+1]], [lats[c], lats[c+1]],color=StrTrim(scaleddata[c],2), Thick=2
FOR c=0,s-1 DO cgPlotS, lons[c], lats[c], PSym=2, Color=StrTrim(scaleddata[c],2)

vals, lons and lats have 300 element each.
However, about the second last FOR I am getting the following: Expression must be a scalar in this context: <LONG Array[1]>.

Can someone help me and tell me what I am doing wrong?

Regards,
Rob.
Re: PlotS, Color [message #81608 is a reply to message #81602] Sat, 06 October 2012 10:28 Go to previous messageGo to next message
Phillip M. Bitzer is currently offline  Phillip M. Bitzer
Messages: 7
Registered: September 2012
Junior Member
Seems to me this article will be quite helpful:

http://www.idlcoyote.com/graphics_tips/coloredline.html
Re: PlotS, Color [message #81699 is a reply to message #81602] Sat, 06 October 2012 18:09 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
robinson.inj@gmail.com writes:

> Can someone help me and tell me what I am doing wrong?

I'm going to guess that s is a two-element array. I
suspect vals is a 1x300 array.

Cheers,

David



--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thue. ("Perhaps thos speakest truth.")
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Combined wavelet and cgImage question (and problem)
Next Topic: Self Organizing Maps (SOMs) program

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

Current Time: Wed Oct 08 18:39:00 PDT 2025

Total time taken to generate the page: 0.00398 seconds