subroutine trgraf_elvis_labelxy(ztitle,zxuns,zyuns)

  ! set minimal label set for x-y plot:  title, x & y axis "units labels...

  use trgraf_elvis
  implicit NONE

  character*(*), intent(in) :: ztitle,zxuns,zyuns

  !-----------------------
  integer ilen
  !-----------------------

  etitle = ztitle; call clean_label(etitle)
  exuns = zxuns;   call clean_label(exuns)
  eyuns = zyuns;   call clean_label(eyuns)

end subroutine trgraf_elvis_labelxy

!=========================================================================
subroutine trgraf_elvis_addlabel(zlabel,iwarn)

  ! add label for x-y plot; set warning flag if max count exceeded.

  use trgraf_elvis
  implicit NONE

  character*(*), intent(in) :: zlabel
  integer, intent(out) :: iwarn

  !-----------------------
  
  if(n_emnlab.eq.max_emnlab) then
     iwarn=1
  else
     n_emnlab=n_emnlab+1
     emnlab(n_emnlab)=zlabel;  call clean_label(emnlab(n_emnlab))
     if(emnlab(n_emnlab).eq.' ') n_emnlab=n_emnlab-1  ! ignore blank labels
     iwarn=0
  endif

end subroutine trgraf_elvis_addlabel

!=========================================================================
subroutine trgraf_elvis_addkylab(zlabel,iwarn)

  ! add key box label for x-y plot; set warning flag if max count exceeded.

  use trgraf_elvis
  implicit NONE

  character*(*), intent(in) :: zlabel
  integer, intent(out) :: iwarn

  !-----------------------
  
  if(n_ekylab.eq.max_ekylab) then
     iwarn=1
  else
     n_ekylab=n_ekylab+1
     ekylab(n_ekylab)=zlabel;  call clean_label(ekylab(n_ekylab))
     iwarn=0
  endif

end subroutine trgraf_elvis_addkylab

subroutine trgraf_rhs_label(ilen)

  use trgraf_elvis
  implicit NONE

  integer,intent(in) :: ilen   ! length of "side" labels

  sidelab_len = ilen
  n_sidelab = 0

end subroutine trgraf_rhs_label

subroutine trgraf_add_rhs_label(zlabel)

  use trgraf_elvis
  implicit NONE

  character*(*), intent(in) :: zlabel

  integer ilen

  if(n_sidelab.eq.max_sidelab) return  ! exit if no more room for labels

  if(sidelab_len.eq.0) sidelab_len=20  ! defaulted length

  ilen = min(len(zlabel),sidelab_len)
  n_sidelab = n_sidelab + 1
  esidelab(n_sidelab) = zlabel(1:ilen)

end subroutine trgraf_add_rhs_label

!=========================================================================
