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

Home » Public Forums » archive » Re: Help with vert_colors and rgb_table
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: Help with vert_colors and rgb_table [message #82957] Tue, 29 January 2013 09:56
justinclouds is currently offline  justinclouds
Messages: 25
Registered: December 2012
Junior Member
On Tuesday, January 29, 2013 10:19:27 AM UTC-7, Mark Piper wrote:
> On Monday, January 28, 2013 10:33:20 AM UTC-7, justinclouds wrote:
>
>>
>
>> What I need is to be able to show the color scale in the plot area to give an indication of the scale on the z values. Also, can the color range in z values be controlled?
>
>>
>
>
>
> There are a few ways to handle this. If you have IDL 8.2, here's one:
>
>
>
> x = 2*!pi*findgen(50)/49
>
> y = sin(x)*cos(2*x)
>
> z = round(randomu(1, 50)*100)
>
> p = plot(x, y, 'o', $
>
> /sym_filled, $
>
> vert_colors=bytscl(z), $
>
> rgb_table=39)
>
> cb = colorbar(rgb_table=39, $
>
> range=[0,100], $
>
> position=[0.50, 0.20, 0.90, 0.23])
>
>
>
> Note that I bytescaled the Z values.
>
>
>
> mp

That's what I needed. Thanks!
Re: Help with vert_colors and rgb_table [message #82958 is a reply to message #82957] Tue, 29 January 2013 09:19 Go to previous message
Mark Piper is currently offline  Mark Piper
Messages: 198
Registered: December 2009
Senior Member
On Monday, January 28, 2013 10:33:20 AM UTC-7, justinclouds wrote:
>
> What I need is to be able to show the color scale in the plot area to give an indication of the scale on the z values. Also, can the color range in z values be controlled?
>

There are a few ways to handle this. If you have IDL 8.2, here's one:

x = 2*!pi*findgen(50)/49
y = sin(x)*cos(2*x)
z = round(randomu(1, 50)*100)
p = plot(x, y, 'o', $
/sym_filled, $
vert_colors=bytscl(z), $
rgb_table=39)
cb = colorbar(rgb_table=39, $
range=[0,100], $
position=[0.50, 0.20, 0.90, 0.23])

Note that I bytescaled the Z values.

mp
Re: Help with vert_colors and rgb_table [message #82972 is a reply to message #82958] Mon, 28 January 2013 09:40 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
justinclouds writes:

> I am trying to plot x, y and z where x and y are plotted in XY plot and z is a color vector. This is the command I use and it works well:
>
> p=plot(x, y, symbol='o', LINESTYLE = ' ', vert_colors=z, rgb_table=39)
>
> What I need is to be able to show the color scale in the plot area to give an indication of the scale on the z values. Also, can the color range in z values be controlled?
>
> More info:
> x, y and z are FLOAT = Array[507]
> z has range from 0 to 100.
>
> Any help with proper syntax is appreciated.

I don't know how this is done in function graphics. There
is an example of how it is done in Coyote Graphics in the
Colored Line Plots example in the Gallery. To restrict Z
to 100 colors, for example, simply replace the value
255 with 100 in the elevColors variable, and restrict your
color table to 100 colors with the NColors keyword.

http://www.idlcoyote.com/gallery/

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: Re: 3-D arrows
Next Topic: 2013 Collection Of Solution Manuals & Test Banks. More Than 15,000 Titles

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

Current Time: Wed Oct 08 15:13:13 PDT 2025

Total time taken to generate the page: 0.00698 seconds