!
! @ p_legend X|Y Header%
!
define logical is_x
!
! Legend and coordinate definitions
if ("&1".eq."X") then
  let is_x yes
else if ("&1".eq."Y") then
  let is_x no
else
  return
endif
define character legend*20
let legend  box%legend&1 /forma A20
!
if is_x then
  @ window_xy 'nx_box' 'ny_box' 'int((nx_box+1)/2)' 1
  greg1\draw text 0 -2 'legend' 5 0 /char 2
else
  !
  @ window_xy 'nx_box' 'ny_box'  1 'int((ny_box+1)/2)'
  if ny_box.gt.2 then
    greg1\draw text -2  0 'legend' 5 90 /char 4
  else
    greg1\draw text -5.5  0 'legend' 5 90 /char 4
  endif
endif
