[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: formatting yticks over orders of mag.



Paul van Delst wrote:
> 
> Hi,
> 
> Is there a way in PLOT, /YLOG to format the yticks "dynamically". E.g.
> If my y-values range from 0.001 to 10000, can the ytick labels be forced
> to be
> 
> 0.001, 0.01, 0.1, 1, 10, 100, 1000, 10000
> 
> rather than
> 
> 0.001, 0.010, 0.100, 1.000, 10.000, 100.000, 1000.000, 10000.000
> 
> The latter requires me to change my XMARGIN keyword so that I can see
> the y-axis label to such an extent that there's not much plot area left
> (due to the 10000.000). I would rather not do the 10^n format since it
> doesn't give the same impression of magnitude change (plotology :o). I
> looked at the YICKFORMAT documentation but that seems to apply to *all*
> the ytick values. I am wrong about this?

Well, I tried the most simple-minded thing and bugger me if it didn't
work. Cool.

I used the following with YTICKFORMAT='ylogticks' in the PLOT command:

FUNCTION ylogticks, axis, index, value

  exponent = LONG( ALOG10( value ) )

  CASE 1 OF

    ( exponent LT 0 ): format = '( f' + $
                                STRTRIM( ABS( exponent ) + 2, 2 ) + $
                                '.' + $
                                STRTRIM( ABS( exponent ), 2 ) + $
                                ' )'

    ( exponent GE 0 ): format = '( i' + $
                                STRTRIM( ABS( exponent ) + 1, 2 ) + $
                                ' )'

  ENDCASE

  RETURN, STRING( value, FORMAT = format )

END

and it worked just like I wanted.

Sorry for wasting peoples time,

paulv
-- 
Paul van Delst           Ph:  (301) 763-8000 x7274 
CIMSS @ NOAA/NCEP        Fax: (301) 763-8545
Rm.202, 5200 Auth Rd.    Email: pvandelst@ncep.noaa.gov
Camp Springs MD 20746