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

Home » Public Forums » archive » Scientific Notation on Log Plots
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
Scientific Notation on Log Plots [message #5711] Tue, 06 February 1996 00:00 Go to next message
boswell is currently offline  boswell
Messages: 7
Registered: October 1994
Junior Member
I've got a bizarre formatting problem going on with IDL V4.0.1 on an Alpha
VMS machine. When I make a plot with the /ylog keyword, my plot comes out
with neatly labelled scientific notation on the y axis. The notation actually
has a number, followed by an asterisk, followed by a 10, and finally with an
actual superscript number for the exponent. But I need to take control of
the format using, for example, the ytickformat keyword. Only problem: the
format reverts to normal FORTRAN-style formatting, with a nn.nE+mm style.
In other words, the default neat exponential format goes away.

Is there any way to control the formatting of the default scientific notation?

Jonathan Boswell
FDA/CDRH
Re: Scientific Notation on Log Plots [message #5793 is a reply to message #5711] Thu, 08 February 1996 00:00 Go to previous messageGo to next message
zawodny is currently offline  zawodny
Messages: 121
Registered: August 1992
Senior Member
In article <1996Feb7.204257.12075@pinet.aip.org> boswell@pinet.aip.org (jonathan_boswell) writes:
> zawodny@arbd0.larc.nasa.gov (Joseph M Zawodny) writes:
> : Try using some variant of this function with YTICKFORMAT. I use this to
> : get "even" powers of ten, but you can hack it to give 2.3*10^3 or whatever.
>
> [snip]
>
> Thanks Joe. Your routine is very clever. However did you figure out what
> parameters to give it?
>
> For those of you who don't know about it, the YTICKFORMAT keyword can take
> not only a format specifier, such as "(F9.0)", but also a function name.
> Apparently IDL then calls the function repeatedly when labelling the axis.

You do not need to give it any parameters, IDL sees the string stored in
the YTICKFORMAT keyword and calls that function with the proper parameters
automatically for each and every tickmark it is going to label on that axis.
When you write your function, you have to use the proper parameter list
that is defined in the IDL manuals somewhere. Just copy mine - it works!

In order to make my LOGTICK function work for fractional powers of ten
you will have to recreate the mantissa from the decimal portion of the
log10 of the tick value.


logval = log10(tickvalue)
exponent = strtrim(fix(logval),2)
mantissa = strtrim(string(10.^(logval mod 1.),form='(f3.2)'),2)
newtick = mantissa+'*10!u'+exponent+'!n'

I know the variables I use here are not the same ones as in the function
I posted earlier, but you can figure it out for yourself.

Have fun,

--
Dr. Joseph M. Zawodny KO4LW NASA Langley Research Center
E-mail: J.M.Zawodny@LaRC.NASA.gov MS-475, Hampton VA, 23681-0001
Re: Scientific Notation [message #62468 is a reply to message #5711] Mon, 08 September 2008 16:25 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Jeff writes:

> have a trouble with a very large number... Comments are welcome!!!
>
> I have the following data subset:
>
> lat, long, data
> -24.2 -56.3 234.4
> -24.1 -56.2 456.5
> -24.2 -56.2 NaN
> -24.5 -56.3 232.4
> -24.7 -52.3 NaN
> ....
> I need to fill the NaN cells with 1.70171e38. I'm doing this:
>
> index = where(finite(temp, /nan), count)
> if count ne 0 then temp[index] = 1.70141e38
>
> It works fine. Then I'm exporting it to an ascii file (using
> output_to_ascii_doit) and I got:
>
> -24.2 -56.3 234.4
> -24.1 -56.2 456.5
> -24.2 -56.2 ********************
> -24.5 -56.3 232.4
> -24.7 -52.3 *******************
> ....
>
> How can I write this right number (1.70171e38) correctly?

Pass OUTPUT_TO_ASCII_DOIT the correct output format. That
is to say, something other than the F6.1 you appear to be
using. You will need something with enough width to accommodate
this number.

Cheers,

David

P.S. I don't know OUTPUT_TO_ASCII_DOIT, but presumably
you can pass it some kind of a format, perhaps via a
FORMAT keyword.

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: inverse the axis
Next Topic: inverse the axis

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

Current Time: Wed Oct 08 13:34:05 PDT 2025

Total time taken to generate the page: 0.00434 seconds