X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 30 Sep 2010 03:01 PM by  anon
IDL 8.0 colorbar
 3 Replies
Sort:
You are not authorized to post a reply.
Author Messages

anon



New Member


Posts:
New Member


--
30 Sep 2010 03:01 PM
    I'm still getting used to the new Graphics, but there is one thing that is driving me crazy: The COLORBAR function needs a "target" Graphics object to figure out which color palette to use. However, although IMAGE and CONTOUR functions have min_value and max_value paramters that you can use to change the dynamic range of color scale in the "target" plot, these changes are not reflected in the colorbar.....it still shows the actual min and max ranges of the original data. Here is a simple example: 1) First, this works OK: data = dist(300,300) image = IMAGE(data,rgb_table=13,dimension=[500,500]) cb = COLORBAR(target=image) 2) Now truncate the color range, but the colorbar still ranges from MIN(data) to MAX(data): image = IMAGE(data,rgb_table=13,dimension=[500,500],min_value=100,max_value=200) cb = COLORBAR(target=image) 3) And, even worse, expand the color range and the colorbar goes black.... image = IMAGE(data,rgb_table=13,dimension=[500,500],min_value=-100,max_value=500) cb = COLORBAR(target=image) I've tricked colorbar for case #2 by clipping the data: data=((data > 100) Any suggestions appreciated!

    Deleted User



    New Member


    Posts:
    New Member


    --
    05 Oct 2010 12:26 PM
    Related to colorbar.... is there anyway to make it only plot X number of colors? For example, in my contour routine, I specify the RGB_TABLE, and then give it 10 discrete colors. Colorbar appears to have no way to plot only those 10 to match the plot? Instead it plots all 255. I'm also having issues getting it to match my range of contour levels. In my case, it won't even plot the same number of major ticks I want. I try specifying the specifictickinterval,tickvalues, major, etc, but it just won't behave. Another weird problem I have is I can't get ticklen to work properly. Default at 0.2 works right. I try to set to ticklen=1 and it doesn't change.

    Deleted User



    New Member


    Posts:
    New Member


    --
    18 Feb 2011 12:56 AM
    I use the following trick. Let f_min, f_max be the extreme values of the data. These correspond to the values of MIN and MAX in your e-mail. I create a 2x2 array (AR) and put AR[1,1]=f_min; AR[2,2]=f_max. Then I plot AR with imxxx = IMAGE(AR,...,etc, ...,HIDE=1). If I now run colorbar with "COLORBAR(TARGET=imxxx, ...)", it takes into account only the range of values included between f_min and f_max. It's just a trick but it works.

    Deleted User



    New Member


    Posts:
    New Member


    --
    20 Feb 2011 01:13 AM
    Hi, there may be a another ways with major and tickname, cb=colorbar(target=image, major=7, tickname=string(indgen(7)-100))
    You are not authorized to post a reply.