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

Home » Public Forums » archive » colorbar
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
colorbar [message #88410] Wed, 23 April 2014 05:53 Go to next message
shbhuk is currently offline  shbhuk
Messages: 1
Registered: April 2014
Junior Member
I am trying to add a colorbar to the image generated by tvim and following is the code I am using.


---

loadct,4,ncolors=100


grid=bytscl(grid,0,1000)

tvim,grid
colorbar,ncolors=100


Though I get a colorbar on the image, the colorbar is empty and does not have the colorgradient.

On using cgcolorbar and tvim for the same, the colorbar obtained does not match with the color values in the image.
Re: colorbar [message #88411 is a reply to message #88410] Wed, 23 April 2014 06:52 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
shbhuk@gmail.com writes:

> On using cgcolorbar and tvim for the same, the colorbar obtained does not match with the color values in the image.

Yes, because you scale your image into 255 values, but use only 100
colors in your color bar. If you want to match your image, the values in
the image have to match the colors in the color bar.

cgloadct, 4, ncolors=100
grid = cgDemodata(18)
grid = bytscl(grid, Top=99, Min=0, Max=100)
cgImage, grid, Position=[0.125, 0.1, 0.925, 0.8], /Axes
cgColorbar, ncolors=100, range=[0, 100]

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: Reading a Python numpy save (.npy) file into IDL
Next Topic: How to delete a variable

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

Current Time: Wed Oct 08 13:28:47 PDT 2025

Total time taken to generate the page: 0.00585 seconds