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

Home » Public Forums » archive » log scale of data coloring of IDLgrVolume object, not the axes
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: log scale of data coloring of IDLgrVolume object, not the axes [message #29227 is a reply to message #29034] Fri, 08 February 2002 18:26 Go to previous message
tbowers0 is currently offline  tbowers0
Messages: 11
Registered: August 2001
Junior Member
"1" <j@msn.com> wrote in message news:<a40v84$h4k$1@ra.nrl.navy.mil>...
> David Fanning <david@dfanning.com> wrote in message
>>
>> HColorbar isn't designed for log scales, of course,
>> but I think it is just a matter of passing it a

Ahhh, but it can! (with some foolin' around) After much ballyhooing
with the LOG keyword to the textAxis in Hcolorbar (an IDLgrAxis) and
giving that up, I found a workaround with a lotta help from Martin
Shultz's logLevels fn.

oColorBar = Obj_New('HColorBar', $
Palette=oColorPalette, $
Range=cbarRange, $
Title=colorBarTitle, $
Position=[cbBottomLeft[0], cbBottomLeft[1], $
cbTopRight[0], cbTopRight[1]], $
COLOR=axisColor)

if (keyword_set(log)) then begin
;//must alter the colorbar's text.
; logLevels() fn. defaults to .1 if I don't set
; it explicitly, too hi for me
if (cbarRange[0] le 0.0) then minLogVal = 0.01 $
else minLogVal = cbarRange[0]
maxLogVal = cbarRange[1]

;get my string of log values, and formatted nicely too
logtext = strtrim(string(logLevels(MIN=minLogVal, MAX=maxLogVal,
/fine), FORMAT='(f10.2)'), 2)

;//only show the decades, not the in-betweeners
idx = where((indgen(n_elements(logtext)) mod 3) eq 0, count)
if (count gt 0) then begin
temp = reverse(logtext)
temp[1:*] = "" ;keep the last entry, set rest to ''
temp = reverse(temp)
temp[idx] = logtext[idx]
logtext = temp
endif

;//set new properties
oColorBar->setProperty, MAJOR=n_elements(logtext)
oColorBar->getProperty, TEXT=oAxisText
oAxisText->setProperty, STRINGS=logtext
endif

Viola! The only problem is that the scale actually only goes up to
maxLogVal, the pretty logged values returned by logLevels(), not my
actual max of my data. Eg data ranges [0,65], the axis text will look
like

0.01 0.10 1.00 10.00 50.00

when it should be something like

0.01 0.10 1.00 10.00 65.00

The short-spacing and misalignment at the end is intentional. I can't
just replace the 50 at the end with 65, because 65 > 50 so it's
spacing from the value to its left (10.00) should be a bit more than
for 50.00. The next even spaced entry would, of course, be 100.00. Any
takers on a solution?

Maybe Dave will add a LOG keyword and slap this code in so's I won't
have to copy it into every program that I'll use it.;)

t
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Re: All day FFT....
Next Topic: Re: prime factors (was Re: All day FFT....)

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

Current Time: Fri Oct 10 00:36:11 PDT 2025

Total time taken to generate the page: 7.12015 seconds