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

Home » Public Forums » archive » Re: logarithmic axis lables
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: logarithmic axis lables [message #56945] Wed, 28 November 2007 04:30 Go to previous message
Haje Korth is currently offline  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
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: use of RANDOMU
Next Topic: display gray image with NaN

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

Current Time: Wed Oct 08 11:11:36 PDT 2025

Total time taken to generate the page: 0.00461 seconds