Re: Labelling the axes on a log plot [message #60715] |
Sun, 08 June 2008 10:19 |
Jeremy Bailin
Messages: 618 Registered: April 2008
|
Senior Member |
|
|
>> So i want to label a log axis for example with these values -> 1. 0.1
>> 0.01 0.001 etc however what i get is 1.000 0.100 0.010 my problem is
>> the zeros after the value after the decimal point. What is the format
> Another option (but not what you wanted) is logticks_exp from this
> post:
>
> http://groups.google.com/group/comp.lang.idl-pvwave/browse_f rm/thread...
Here's an equivalent function, based heavily on Paul's code, that
should do what you want:
FUNCTION croppedtickmarks, axis, index, value
; number of decimal digits:
ndecdig = ceil(-(alog10(value))) > 0
; string version
ndigitstr = string(ndecdig, format='(I0)')
; reformat value with the desired number of decimal places. use
integers for 0
if ndecdig eq 0 then tickmark = string(value, format='(I0)') $
else tickmark = string(value, format='(F0.'+ndigitstr+')')
return, tickmark
END
-Jeremy.
|
|
|
|