Re: logarithmic axis lables [message #56945] |
Wed, 28 November 2007 04:30  |
Haje Korth
Messages: 651 Registered: May 1997
|
Senior Member |
|
|
Paul, saver of my life, thank you! Haje
"Paul van Delst" <Paul.vanDelst@noaa.gov> wrote in message
news:fii53h$skj$1@news.nems.noaa.gov...
> Haje Korth wrote:
>> Hi,
>> Is there a way to convince IDL to use axis lables like 10^-1 (10!U-1!N in
>> hershey language) instead of 0.1? Plot sets this automatically to the
>> former format if for very small and very large numbers, but is there a
>> way to always force this format?
>>
>> Hints highly appreciated!
>>
>> Thanks,
>> Haje
> ;+
> ;
> ; (C) Cooperative Institute for Meteorological Satellite Studies, 2000
> ;
> ; NAME:
> ; logticks_exp
> ;
> ; PURPOSE:
> ; Function to print logarithmic axis tickmarks with exponential
> ; output.
> ;
> ; CATEGORY:
> ; Graphics
> ;
> ; LANGUAGE:
> ; IDL v5
> ;
> ; CALLING SEQUENCE:
> ; PLOT, x, y, /YLOG, YICKFORMAT = 'logticks_exp'
> ;
> ; INPUTS:
> ; axis: the axis number. 0 for X axis, 1 for Y axis, 2 for Z axis.
> ; index: the tick mark index which starts at 0.
> ; value: the default tick mark value (a floating-point number);
> ;
> ; OUTPUTS:
> ; Function returns a string containing the tick mark labels.
> ;
> ; CREATION HISTORY:
> ; Written by: Paul van Delst, CIMSS/SSEC, 08-Nov-2000
> ; paul.vandelst@ssec.wisc.edu
> ;
> ;-
> FUNCTION logticks_exp, axis, index, value
> ; Determine the base-10 exponent
> exponent = LONG( ALOG10( value ) )
> ; Construct the tickmark string based on the exponent
> tickmark = '10!E' + STRTRIM( STRING( exponent ), 2 ) + '!N'
> ; Return the formatted tickmark string
> RETURN, tickmark
> END
>
>
>
> Use it thusly:
>
> IDL> x=dindgen(1000)+1.0d0
> IDL> y=x^2
> IDL> plot, x, y, /ylog,ytickformat='logticks_exp',charsize=2
>
>
> cheers,
>
> paulv
|
|
|
Re: logarithmic axis lables [message #56950 is a reply to message #56945] |
Tue, 27 November 2007 14:18   |
Paul Van Delst[1]
Messages: 1157 Registered: April 2002
|
Senior Member |
|
|
Haje Korth wrote:
> Hi,
> Is there a way to convince IDL to use axis lables like 10^-1 (10!U-1!N in
> hershey language) instead of 0.1? Plot sets this automatically to the former
> format if for very small and very large numbers, but is there a way to
> always force this format?
>
> Hints highly appreciated!
>
> Thanks,
> Haje
>
>
;+
;
; (C) Cooperative Institute for Meteorological Satellite Studies, 2000
;
; NAME:
; logticks_exp
;
; PURPOSE:
; Function to print logarithmic axis tickmarks with exponential
; output.
;
; CATEGORY:
; Graphics
;
; LANGUAGE:
; IDL v5
;
; CALLING SEQUENCE:
; PLOT, x, y, /YLOG, YICKFORMAT = 'logticks_exp'
;
; INPUTS:
; axis: the axis number. 0 for X axis, 1 for Y axis, 2 for Z axis.
; index: the tick mark index which starts at 0.
; value: the default tick mark value (a floating-point number);
;
; OUTPUTS:
; Function returns a string containing the tick mark labels.
;
; CREATION HISTORY:
; Written by: Paul van Delst, CIMSS/SSEC, 08-Nov-2000
; paul.vandelst@ssec.wisc.edu
;
;-
FUNCTION logticks_exp, axis, index, value
; Determine the base-10 exponent
exponent = LONG( ALOG10( value ) )
; Construct the tickmark string based on the exponent
tickmark = '10!E' + STRTRIM( STRING( exponent ), 2 ) + '!N'
; Return the formatted tickmark string
RETURN, tickmark
END
Use it thusly:
IDL> x=dindgen(1000)+1.0d0
IDL> y=x^2
IDL> plot, x, y, /ylog,ytickformat='logticks_exp',charsize=2
cheers,
paulv
|
|
|
|