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

Home » Public Forums » archive » Re: plot label help
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: plot label help [message #10161] Fri, 10 October 1997 00:00 Go to previous message
Martin Schultz is currently offline  Martin Schultz
Messages: 515
Registered: August 1997
Senior Member
Rick McDaniel wrote:
>
> Here's the one I wrote. It's not a thing of beauty. It works great but
> has one flaw. Instead of printing 10^0, it justs prints 10. The other
> exponents print out fine. Again any help appreciated.
>
> FUNCTION LOGTICKS, axis, index, value
>
> IF value/10.0^9 EQ 1.0 THEN n = 9
> IF value/10.0^8 EQ 1.0 THEN n = 8
> IF value/10.0^7 EQ 1.0 THEN n = 7
[cut]

This indeed looks weird! Try the following:
IDL> x = 10^(findgen(20)-8)
IDL> print,fix(alog10(x))
-8 -7 -6 -5 -4 -3 -2 -1 0
1 2 3 4 5 6 7 8 9
10 11
You can also use something like ceil(alog10(val)) in order to get
integer exponents
for values ne 10, 100, 1000, etc.

>
> RETURN, STRING(n, $
> FORMAT="('10!E',i2.0)")
> END
>

If you use format=i2 instead of i2.0, the 0 will be printed ! Also, to
improve the
look of you numbers you may want to try
return, strcompress( string(n, format="('10!E',i2)")) , /remove_all)
This eliminates the blanks in e.g. 10!E 4.


Cheers,
Martin.

------------------------------------------------------------ ------------Dr.
Martin Schultz
Department for Earth&Planetary Sciences, Harvard University
186 Pierce Hall, 29 Oxford St., Cambridge, MA-02138, USA

phone: (617)-496-8318
fax : (617)-495-9837
Please indicate name and room (186 Pierce) when sending a fax

e-mail: mgs@io.harvard.edu
IDL-homepage: http://www-as.harvard.edu/people/staff/mgs/idl/
------------------------------------------------------------ ------------
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Maker Interchange Format (MIF) device driver, v.1.06, Part02/02
Next Topic: problem with reading formated file

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

Current Time: Wed Oct 08 16:01:30 PDT 2025

Total time taken to generate the page: 0.00495 seconds