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

Home » Public Forums » archive » Re: Labelling the axes on a log plot
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Labelling the axes on a log plot [message #60715] Sun, 08 June 2008 10:19
Jeremy Bailin is currently offline  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.
Re: Labelling the axes on a log plot [message #60719 is a reply to message #60715] Sat, 07 June 2008 15:51 Go to previous message
Brian Larsen is currently offline  Brian Larsen
Messages: 270
Registered: June 2006
Senior Member
On Jun 7, 11:10 am, clivecoo...@gmail.com wrote:
> 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
> code to do this correctly

Clive, the number of zeros after the decimal point is set so that
they all are the same length... but that you knew. I don't know how
to change that other than specifying them yourself with ytickname.

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/fb4d6ebe49a3b073/49f61fc123ab9c1b?lnk=gst&q=lo gticks_exp



Cheers,

Brian

------------------------------------------------------------ --------------
Brian Larsen
Boston University
Center for Space Physics
http://people.bu.edu/balarsen/Home/IDL
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: combining color tables
Next Topic: Re: vertical line that moves with cursor in draw widget

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

Current Time: Wed Oct 08 17:03:58 PDT 2025

Total time taken to generate the page: 0.00454 seconds