Re: PlotS, Color [message #81602] |
Sat, 06 October 2012 17:08  |
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.
|
|
|