clamp_view Subroutine

private subroutine clamp_view()

Keep view limits inside data.

Bounds from xedge and ystar (so follow axis and unit changes), clamped in world coords so log axes clamp correctly. Pan keeps its span and stops at data edge; view larger than data snaps to full range.

Arguments

None

Source Code

   subroutine clamp_view()
      !! Keep view limits inside data.
      !!
      !! Bounds from `xedge` and `ystar` (so follow axis and unit changes), clamped in world coords
      !! so log axes clamp correctly. Pan keeps its span and stops at data edge; view larger than
      !! data snaps to full range.
      real(real64) :: wlo, whi, w1, w2
      wlo = xtrans(xedge(1)); whi = xtrans(xedge(nmodels + 1))
      w1 = xtrans(st%xmin); w2 = xtrans(st%xmax)
      call clamp1(wlo, whi, w1, w2)
      st%xmin = inv_x(w1); st%xmax = inv_x(w2)
      wlo = ytrans2(ybound_lo()); whi = ytrans2(maxval(ystar)/yscale())
      w1 = ytrans2(st%ymin); w2 = ytrans2(st%ymax)
      call clamp1(wlo, whi, w1, w2)
      st%ymin = inv_y(w1); st%ymax = inv_y(w2)
   end subroutine clamp_view