greg2\rgdata &1 /variable
!
! The BOX_LIMITS variable is set to specify whatever you want
if (box_limits.ne." ") then
  symbol alimits 'box_limits'
  greg1\limits 'alimits' /rgdata
  return
endif
define real sec
let sec box%aunit
!
greg1\limits /rgdata
define integer n p
let n &1%x_axis*&1%y_axis
!
if (n.eq.0) then
  ! No spatial axis - Check if a Velocity axis is there, and use the appropriate range
  let n &1%f_axis
  if n.eq.0 return
  !
  ! The SPAN variable indicates the Velocity range
  if (span[1].ne.0).or.(span[2].ne.0) then
    if (n.eq.1) then
      limits span[1] span[2] = =
    else
      limits = = span[1] span[2] 
    endif
  endif
  return  
else  if (n.eq.2) then
  ! 2 spatial axes
  if ((size[1].ne.0).or.(size[2].ne.0)) then
    if (size[1].eq.0) then
      greg1\limits = = (center[2]-size[2]/2)*sec (center[2]+size[2]/2)*sec 
    else if (size[2].eq.0) then
      greg1\limits (center[1]+size[1]/2)*sec (center[1]-size[1]/2)*sec = = 
    else
      greg1\limits (center[1]+size[1]/2)*sec (center[1]-size[1]/2)*sec (center[2]-size[2]/2)*sec (center[2]+size[2]/2)*sec      
    endif
  endif
  return
else
  ! 1 dimension axis + 1 frequency axis
  ! Try the SPAN control...
  let n &1%x_axis
  if (&1%x_axis.lt.3) then  
    let p 3-n   ! The other axis, which match the "channel/velocity/frequency/other" axis
  else
    let n &1%y_axis
    let p 3-n
  endif
  !
  ! 2 cases : angles along X or Y
  if (n.eq.1) then
    if (size[n].ne.0) then
      if (span[1].ne.0.or.span[2].ne.0) then
        greg1\limits (center[1]+size[1]/2)*sec (center[1]-size[1]/2)*sec span[1] span[2]
      else
        greg1\limits (center[1]+size[1]/2)*sec (center[1]-size[1]/2)*sec = =
      endif
    else
      if (span[1].ne.0.or.span[2].ne.0) then
        greg1\limits = = span[1] span[2]
      endif
    endif
  else
    if (size[n].ne.0) then
      if (span[1].ne.0.or.span[2].ne.0) then
        greg1\limits span[1] span[2] (center[2]+size[2]/2)*sec (center[2]-size[2]/2)*sec 
      else
        greg1\limits = = (center[2]+size[2]/2)*sec (center[2]-size[2]/2)*sec 
      endif
    else if (span[1].ne.0.or.span[2].ne.0) then
      greg1\limits = = span[1] span[2] = =
    endif
  endif
endif
    
