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

Home » Public Forums » archive » Re: Using [XYZ]TICKFORMAT for dynamic formatting
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: Using [XYZ]TICKFORMAT for dynamic formatting [message #66486 is a reply to message #66478] Wed, 20 May 2009 05:29 Go to previous messageGo to previous message
David Gell is currently offline  David Gell
Messages: 29
Registered: January 2009
Junior Member
On May 19, 10:09 am, Paul van Delst <paul.vande...@noaa.gov> wrote:
> Hello,
>
> Given the following xtickformat function,
>
>    FUNCTION lowticks, axis, index, value
>      RETURN, STRING( value, FORMAT = '("!C",f7.3)' )
>    END
>
> I am doing something like the following to get the x-axis tick labels on every other plot
> printed on the next line:
>
>    !P.MULTI = [0,n_xplots,1]
>    !X.OMARGIN = [10,3]
>    !X.MARGIN  = [0,0]
>    !Y.OMARGIN = [2,0]
>    !Y.MARGIN  = [4,2]
>
>    FOR i = 0, n_xplots-1 DO BEGIN
>      IF ( i EQ 1 OR i EQ 3 ) THEN BEGIN
>        xtickformat = 'lowticks'
>      ENDIF ELSE BEGIN
>        xtickformat = ''
>      ENDELSE
>
>      PLOT, x, y, XTICKFORMAT = xtickformat
>
>      ...etc...
>
> to prevent the end-of-axis tick labels from adjacent plots overwriting each other.
>
> The problem is that I want the format in the "lowticks" function, the "f7.3", to be the
> same as those automagically chosen by IDL in the plots where the xtickformat defaults.
>
> Does anyone know if there is any way to dynamically set the format string itself in this
> fashion? I.e. pass in the "f7.3" (or f4.1 or f5.2 etc) ?
>
> cheers,
>
> paulv

I usually do something like the following when I have to pass data to
a callback routine.
Change the lowticks routine as follows:


FUNCTION lowticks, axis, index, value, format=format
common qqlowticks, sFormat
if n_elements(sFormat) eq 0 then sFormat='("!C",f7.3)' ;;
initialize state memory
if keyword_set(format) ne 0 then begin
sFormat=format
return, 0
endif

RETURN, STRING( value, FORMAT = sFormat
END

Then, prior to using lowticks as the value of the xtickformat keyword
argument, you set the
format string,

nDummy=lowticks(format='(F7.3)'

plot, ..., xtickformat=lowticks

Hope this helps.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Transporting code from one mac to another: Problem connection to X windows server...
Next Topic: New Business Venture

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

Current Time: Wed Oct 08 19:26:37 PDT 2025

Total time taken to generate the page: 0.00429 seconds