Re: plot label help [message #10161] |
Fri, 10 October 1997 00:00 |
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/
------------------------------------------------------------ ------------
|
|
|
Re: plot label help [message #10164 is a reply to message #10161] |
Fri, 10 October 1997 00:00  |
rickeym
Messages: 6 Registered: September 1997
|
Junior Member |
|
|
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
IF value/10.0^6 EQ 1.0 THEN n = 6
IF value/10.0^5 EQ 1.0 THEN n = 5
IF value/10.0^4 EQ 1.0 THEN n = 4
IF value/10.0^3 EQ 1.0 THEN n = 3
IF value/100 EQ 1.0 THEN n = 2
IF value/10.0 EQ 1.0 THEN n = 1
IF value EQ 1.0 THEN n = 0
IF value*10.0 EQ 1.0 THEN n = -1
IF value*100 EQ 1.0 THEN n = -2
IF value*10.0^3 EQ 1.0 THEN n = -3
IF value*10.0^4 EQ 1.0 THEN n = -4
IF value*10.0^5 EQ 1.0 THEN n = -5
IF value*10.0^6 EQ 1.0 THEN n = -6
IF value*10.0^7 EQ 1.0 THEN n = -7
IF value*10.0^8 EQ 1.0 THEN n = -8
IF value*10.0^9 EQ 1.0 THEN n = -9
RETURN, STRING(n, $
FORMAT="('10!E',i2.0)")
END
Rick McDaniel
Clemson University
In article <343D09D4.2781@fz-juelich.de>, "R. Bauer"
<r.bauer@fz-juelich.de> wrote:
> Rick McDaniel wrote:
>>
>> I'm using IDL to plot a curve on a log-log scale. I want the y axis
>> labels to be in powers of 10 (i.e. 10^0, 10^1, 10^2, ect). Some times the
>> yxis is lableld the way i want, other times the axis reads 1.0, 10.0,
>> 10.0, ect. Is there a way to always have the y axis labels the way i
>> need. Thanks for any help!
>>
>> Rick McDaniel
>> rickeym@hubcap.clemson.edu
>
> you can write a function which will be called by axes
> xtickformat='my_numberformat'
>
> There is an example on page 65 reference guide idl5
>
> --
> R.Bauer
>
> Institut fuer Stratosphaerische Chemie (ICG-1)
> Forschungszentrum Juelich
> email: R.Bauer@fz-juelich.de
|
|
|
Re: plot label help [message #10170 is a reply to message #10161] |
Thu, 09 October 1997 00:00  |
R. Bauer
Messages: 137 Registered: November 1996
|
Senior Member |
|
|
Rick McDaniel wrote:
>
> I'm using IDL to plot a curve on a log-log scale. I want the y axis
> labels to be in powers of 10 (i.e. 10^0, 10^1, 10^2, ect). Some times the
> yxis is lableld the way i want, other times the axis reads 1.0, 10.0,
> 10.0, ect. Is there a way to always have the y axis labels the way i
> need. Thanks for any help!
>
> Rick McDaniel
> rickeym@hubcap.clemson.edu
you can write a function which will be called by axes
xtickformat='my_numberformat'
There is an example on page 65 reference guide idl5
--
R.Bauer
Institut fuer Stratosphaerische Chemie (ICG-1)
Forschungszentrum Juelich
email: R.Bauer@fz-juelich.de
|
|
|