fit_x_step Subroutine

public subroutine fit_x_step(wx1, wx2, wy1, wy2, xlim, step, nsub)

Choose tick step of linear x axis.

Starts at giza_box's capped automatic step (0.2 of x range, rounded by c_giza_round), widens to next nice step until no x label sits within one character height of the last.

Arguments

Type IntentOptional Attributes Name
real(kind=real64), intent(in) :: wx1

Left window edge, in world coords.

real(kind=real64), intent(in) :: wx2

Right window edge, in world coords.

real(kind=real64), intent(in) :: wy1

Bottom window edge, in world coords.

real(kind=real64), intent(in) :: wy2

Top window edge, in world coords.

real(kind=real64), intent(in) :: xlim

Right limit of x labels, as fraction of page width.

real(kind=real64), intent(out) :: step

Tick step, in world coords.

integer(kind=c_int), intent(out) :: nsub

Minor tick intervals per step.


Source Code

   subroutine fit_x_step(wx1, wx2, wy1, wy2, xlim, step, nsub)
      !! Choose tick step of linear x axis.
      !!
      !! Starts at `giza_box`'s capped automatic step (0.2 of x range, rounded by `c_giza_round`),
      !! widens to next nice step until no x label sits within one character height of the last.
      ! Arguments
      real(real64), intent(in) :: wx1
         !! Left window edge, in world coords.
      real(real64), intent(in) :: wx2
         !! Right window edge, in world coords.
      real(real64), intent(in) :: wy1
         !! Bottom window edge, in world coords.
      real(real64), intent(in) :: wy2
         !! Top window edge, in world coords.
      real(real64), intent(in) :: xlim
         !! Right limit of x labels, as fraction of page width.
      real(real64), intent(out) :: step
         !! Tick step, in world coords.
      integer(c_int), intent(out) :: nsub
         !! Minor tick intervals per step.
      logical :: crowded
      step = c_giza_round(0.2d0*(wx2 - wx1), nsub)
      do
         call tick_labels(wx1, wx2, wy1, wy2, step, 1.d0, xlim, .true., crowded)
         if (.not. crowded) exit
         step = c_giza_round(1.001d0*step, nsub)     ! next nice step up
      end do
   end subroutine fit_x_step