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

Home » Public Forums » archive » Re: Legend creation on an image
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: Legend creation on an image [message #48902 is a reply to message #48901] Fri, 02 June 2006 19:31 Go to previous messageGo to previous message
elsueniero is currently offline  elsueniero
Messages: 5
Registered: May 2006
Junior Member
>> A colorbar with similar characteristics is described in this article:
>>
>> http://www.dfanning.com/map_tips/precipmap.html
>>

I wrote my own code based on yours, now, and I am almost there...
but...

Since I already had a well-known color code for NDVI, I am not using
your function to load colors. And there is where the problem is...
maybe you can help me:

I have:

colores = [[0,0,0],[0,24,104],[254,254,254],[205,193,169], $
[199,186,169],[182,148,111],[170,129,75],[143,115,65], $
[128,105,35],[148,183,19],[116,171,5],[102,162,2],[81,150,0] ,$
[62,129,0],[24,117,3],[1,92,13],[1,71,0],[5,56,5],[0,40,3],[ 2,16,0]]

set_plot, 'Z'
device, set_resolution=[600, 300], set_colors=256, z_buffering=0

; Change the color formats
R = transpose(colores[0,*])
G = transpose(colores[1,*])
B = transpose(colores[2,*])
; Load the colors (starting at 1 like you recommend)
tvlct,r,g,b,1

(..) Some init code we only need here the following
ncolors = n_elements(R)
bottom=1
(..)

; Start drawing
bar = BINDGEN(ncolors) # REPLICATE(1B, 20)
; Fixed position
position = [0.1, 0.85, 0.9, 0.92]

bar = BYTSCL(bar, TOP=(ncolors-1 < (255-bottom))) + bottom

xstart = position(0)
ystart = position(1)
xsize = (position(2) - position(0))
ysize = (position(3) - position(1))

bar = CONGRID(bar, CEIL(xsize*!D.X_VSize), CEIL(ysize*!D.Y_VSize),
/INTERP)

TV, bar, xstart, ystart, /Normal

out = tvrd()
device,/close
set_plot, 'win'

tv,out

And the result is a grayscale RGB 1,1,1 to 20,20,20 bar. Not the
desired result, using the colors I set on the first line.

What could be wrong?

Thank you for your time!!!
Juan
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: HELP!!!!! How to use IDL to create a move?
Next Topic: how to open three single-band files simultaneously

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

Current Time: Fri Oct 10 15:36:46 PDT 2025

Total time taken to generate the page: 1.59889 seconds