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

Re: power style labels




David Fanning wrote:

> Atsushi SHIMIZU (shimizu@kurasc.kyoto-u.ac.jp) writes:
>
> > Could anyone tell me how to force IDL to make labels with power style
> > without using [XYZ]TICKNAME?
> 
> No, I doubt it. :-)

Oh - wanna bet? :-)

Using the xtickformat to name a formatting function, this
can definitely  be done. Try the following:

FUNCTION ytf,axis,index,n
  IF n EQ 0 THEN return,'0' ;; Special case
  
  ex = string(n,'(e7.0)') 
  pt = strpos(ex,'.')
  
  first = strmid(ex,pt-1,1) 
  sgn = strmid(ex,pt+2,1)
  exp = strmid(ex,pt+3,100)

  ;; Shave off leading zero in exponent
  IF strmid(exp,0,1) EQ '0' THEN exp = strmid(exp,1,100) 
  
  IF sgn EQ '-' THEN return,first+'x10!A'+sgn+exp $
  ELSE               return,first+'x10!A'+exp
END

and then do 

   plot, [0, 1e5], ytickformat = 'ytf' 

It appears that the "native" IDL tickmarks use a special
symbol for "times" - not simply an "x".... but that's
just about the only difference I can see!

Regards,

Stein Vidar