log scale of data coloring of IDLgrVolume object, not the axes [message #29034] |
Tue, 29 January 2002 14:03  |
tbowers0
Messages: 11 Registered: August 2001
|
Junior Member |
|
|
Ok, I think I've figured out the whole log axis thing to get an
IDLgrSurface axis to show log scale, its all about scaling the
xyzCoord_Conv property of the surface with the logged bounds of your
data.
But, I'm having trouble carrying this over using log scale for the
coloring of an IDLgrVolume object and the associated Hcolorbar from
David F. (keeping the xyz axes linear, just logging the color ramp).
Could anyone help?
thanks
|
|
|
Re: log scale of data coloring of IDLgrVolume object, not the axes [message #29225 is a reply to message #29034] |
Fri, 08 February 2002 20:12  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Todd Bowers (tbowers0@yahoo.com) writes:
> 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.;)
Maybe, but I'm just going on a trip with my son
to look for the most expensive college. I'll put
it on my list, but you may have to remind me when
I get back. I have a feeling I'm going to feel
depressed and not like doing much programming. :-(
Cheers,
David
--
David W. Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|
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  |
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
|
|
|