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

Home » Public Forums » archive » Re: isurface with custom palette
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: isurface with custom palette [message #69269] Tue, 12 January 2010 08:34 Go to next message
gg is currently offline  gg
Messages: 3
Registered: January 2010
Junior Member
On Jan 12, 5:23 pm, pp <pp.pente...@gmail.com> wrote:
> On Jan 12, 2:12 pm, gg <qonq...@googlemail.com> wrote:
>
>> Thanks a lot! This is exactly what I needed. Now, if I am not asking
>> too much, I would like to know if is posible to insert colorbar with
>> data_colors values but not as specified by the RGB_TABLE keyword?
>
> I am not sure of what you mean. Do you want the colorbar labels to be
> values like
> [-1000,1,25,50,100,150,250,350,500,750,1000,1250,1500,1750,2 000,2500,3000]
> corresponding to the colors you defined in rgb_table? Or is it other
> values?

Yes, I would like to have colorbar values exactly with the values
[-1000,1,25,50,100,150,250,350,500,750,1000,1250,1500,1750,2 000,2500,3000]
Re: isurface with custom palette [message #69272 is a reply to message #69269] Tue, 12 January 2010 08:23 Go to previous messageGo to next message
penteado is currently offline  penteado
Messages: 866
Registered: February 2018
Senior Member
Administrator
On Jan 12, 2:12 pm, gg <qonq...@googlemail.com> wrote:
> Thanks a lot! This is exactly what I needed. Now, if I am not asking
> too much, I would like to know if is posible to insert colorbar with
> data_colors values but not as specified by the RGB_TABLE keyword?

I am not sure of what you mean. Do you want the colorbar labels to be
values like
[-1000,1,25,50,100,150,250,350,500,750,1000,1250,1500,1750,2 000,2500,3000]
corresponding to the colors you defined in rgb_table? Or is it other
values?
Re: isurface with custom palette [message #69273 is a reply to message #69272] Tue, 12 January 2010 08:12 Go to previous messageGo to next message
gg is currently offline  gg
Messages: 3
Registered: January 2010
Junior Member
Thanks a lot! This is exactly what I needed. Now, if I am not asking
too much, I would like to know if is posible to insert colorbar with
data_colors values but not as specified by the RGB_TABLE keyword?

Thank you very much for your support,
Goran

On Jan 11, 6:53 pm, pp <pp.pente...@gmail.com> wrote:
> On Jan 11, 2:34 pm, gg <qonq...@googlemail.com> wrote:
>
>
>
>> I would like to visualize elevation data with iSurface tool using
>> following vector for levels
>> levels =
>> [-1000,1,25,50,100,150,250,350,500,750,1000,1250,1500,1750,2 000,2500,3000]
>> i.e. values lower than 1 with light blue color, then green for values
>> between 1-25, and so on continuing with yellow, brown, up to value
>> 3000, and white for values above. Below is the code which I am trying
>> to use for that purpose, but it seems that I am missing something.
>
>> pro topo3d
>> device, decom=0
>> rgb_table = bindgen(256,3)
>> rgb_table[0:17,0]=
>> [000,140,000,040,080,120,160,200,255,230,200,170,145,120,090 ,135,180,255]
>> rgb_table[0:17,1]=
>> [000,140,100,125,150,175,200,225,255,220,180,150,110,075,040 ,110,180,255]
>> rgb_table[0:17,2]=
>> [000,255,000,000,000,000,000,000,000,000,000,000,000,000,000 ,090,180,255]
>> levels =
>> [-1000,1,25,50,100,150,250,350,500,750,1000,1250,1500,1750,2 000,2500,3000]
>> data = hanning(200,200)*3000
>> isurface, data, RGB_TABLE=rgb_table,texture_image=bytscl(data),
>> vert_colors=levels
>> end
>
>> Could you please be so kind and provide me some hints how to produce
>> figure with surface using custom palette for various levels?
>
> One way is to replace your isurface line with
>
> data_colors=value_locate(levels,data)
> isurface,data,rgb_table=rgb_table,vert_colors=data_colors
>
> The vert_colors must contain either the RGB triples, or the indexes
> into the given colortable of each vertex. Since you already provide
> the colortable through the rgb_table keyword, it is easier to provide
> the indexes in vert_colors. You were passing levels, which was being
> interpreted as a set of colortable indexes, that was used cyclically
> because it was smaller than the number of vertices.
Re: isurface with custom palette [message #69289 is a reply to message #69273] Mon, 11 January 2010 09:53 Go to previous messageGo to next message
penteado is currently offline  penteado
Messages: 866
Registered: February 2018
Senior Member
Administrator
On Jan 11, 2:34 pm, gg <qonq...@googlemail.com> wrote:
> I would like to visualize elevation data with iSurface tool using
> following vector for levels
> levels =
> [-1000,1,25,50,100,150,250,350,500,750,1000,1250,1500,1750,2 000,2500,3000]
> i.e. values lower than 1 with light blue color, then green for values
> between 1-25, and so on continuing with yellow, brown, up to value
> 3000, and white for values above. Below is the code which I am trying
> to use for that purpose, but it seems that I am missing something.
>
> pro topo3d
> device, decom=0
> rgb_table = bindgen(256,3)
> rgb_table[0:17,0]=
> [000,140,000,040,080,120,160,200,255,230,200,170,145,120,090 ,135,180,255]
> rgb_table[0:17,1]=
> [000,140,100,125,150,175,200,225,255,220,180,150,110,075,040 ,110,180,255]
> rgb_table[0:17,2]=
> [000,255,000,000,000,000,000,000,000,000,000,000,000,000,000 ,090,180,255]
> levels =
> [-1000,1,25,50,100,150,250,350,500,750,1000,1250,1500,1750,2 000,2500,3000]
> data = hanning(200,200)*3000
> isurface, data, RGB_TABLE=rgb_table,texture_image=bytscl(data),
> vert_colors=levels
> end
>
> Could you please be so kind and provide me some hints how to produce
> figure with surface using custom palette for various levels?

One way is to replace your isurface line with

data_colors=value_locate(levels,data)
isurface,data,rgb_table=rgb_table,vert_colors=data_colors

The vert_colors must contain either the RGB triples, or the indexes
into the given colortable of each vertex. Since you already provide
the colortable through the rgb_table keyword, it is easier to provide
the indexes in vert_colors. You were passing levels, which was being
interpreted as a set of colortable indexes, that was used cyclically
because it was smaller than the number of vertices.
Re: isurface with custom palette [message #69418 is a reply to message #69269] Tue, 12 January 2010 09:05 Go to previous message
penteado is currently offline  penteado
Messages: 866
Registered: February 2018
Senior Member
Administrator
On Jan 12, 2:34 pm, gg <qonq...@googlemail.com> wrote:
> On Jan 12, 5:23 pm, pp <pp.pente...@gmail.com> wrote:
>
>> On Jan 12, 2:12 pm, gg <qonq...@googlemail.com> wrote:
>
>>> Thanks a lot! This is exactly what I needed. Now, if I am not asking
>>> too much, I would like to know if is posible to insert colorbar with
>>> data_colors values but not as specified by the RGB_TABLE keyword?
>
>> I am not sure of what you mean. Do you want the colorbar labels to be
>> values like
>> [-1000,1,25,50,100,150,250,350,500,750,1000,1250,1500,1750,2 000,2500,3000]
>> corresponding to the colors you defined in rgb_table? Or is it other
>> values?
>
> Yes, I would like to have colorbar values exactly with the values
> [-1000,1,25,50,100,150,250,350,500,750,1000,1250,1500,1750,2 000,2500,3000]

Then, it would be just a matter of adding /insert_colorbar to the
isurface call.

But my guess is you will not like the result. The reason is the way
you created your colortable. It has 256 levels, where the first 18 are
those discrete colors you set, and the next 238 you do not use in your
surface. But the colorbar inserted will have all the 256 colors, not
just the 18 you used, thus the extra 238 odd colors at its end.

One way to solve this is to change the definition of the colorbar, so
that it spans uniformly the 0-255 range, with 18 regions of repeated
values, since you want only 18 discrete levels. It can be done with
congrid to expand the 0-17 0-255 ranges with nearest neighbour
interpolation (thus keeping the levels discrete):

rgb_e=congrid(rgb_table[0:17,*],256,3)
levels_e=congrid(levels,256)
data_colors=value_locate(levels_e,data)
isurface,data,rgb_table=rgb_e,vert_colors=data_colors,/inser t_colorbar
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: pointer & structure
Next Topic: Re: idlwave segfault

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

Current Time: Wed Oct 08 17:48:10 PDT 2025

Total time taken to generate the page: 0.00604 seconds