Draw colour-field colorbar in right margin.
Framed strip of FIELD_NBINS contour colours over field's [vmin, vmax] across whole run,
giza_box round value ticks on right edge. Column name runs up page edge, w/ 'log' on log
scale.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=int32), | intent(in) | :: | f |
Colour field index, as registered in convdata.f90. |
subroutine draw_field_colorbar(f) !! Draw colour-field colorbar in right margin. !! !! Framed strip of `FIELD_NBINS` contour colours over field's [vmin, vmax] across whole run, !! `giza_box` round value ticks on right edge. Column name runs up page edge, w/ 'log' on log !! scale. ! Arguments integer(int32), intent(in) :: f !! Colour field index, as registered in convdata.f90. integer(int32) :: lev, p real(real64) :: dy, y0, t, r, g, b, vlo, vhi, vmag character(len=96) :: title character(len=64) :: unit character(len=8) :: txt call colorbar_viewport() call giza_set_fill(1) dy = 1.d0/real(FIELD_NBINS, real64) do lev = 1, FIELD_NBINS t = (real(lev, real64) - 0.5d0)/real(FIELD_NBINS, real64) call colormap(t, r, g, b) call giza_set_colour_representation(7, r, g, b) call giza_set_colour_index(7) y0 = real(lev - 1, real64)*dy call giza_rectangle(0.d0, 1.d0, y0, y0 + dy) end do call quantity_label(field_names(f), field_units(f), title, unit) vlo = field_vmin(f); vhi = field_vmax(f) if (field_log(f) .neqv. st%cflip) then vlo = log10(field_vpos(f)); vhi = log10(vhi) title = 'log '//trim(title) else ! move a power of ten into the title so tick labels stay short vmag = max(abs(vlo), abs(vhi)) if (vmag >= 1.d4 .or. (vmag > 0.d0 .and. vmag < 1.d-2)) then p = floor(log10(vmag)) vlo = vlo/10.d0**p; vhi = vhi/10.d0**p write (txt, '(i0)') p unit = adjustl('10^{'//trim(txt)//'} '//trim(unit)) end if end if if (len_trim(unit) > 0) title = trim(title)//' ('//trim(unit)//')' call giza_set_colour_index(1) call giza_box('BC', 0.0, 0, 'B', 0.0, 0) ! a constant field has no value range to tick if (vhi > vlo) then call giza_set_window(0.d0, 1.d0, vlo, vhi) call giza_box('', 0.0, 0, 'CMTIV', 0.0, 0) else call giza_box('', 0.0, 0, 'C', 0.0, 0) end if call colorbar_title(0.5d0, 0.5d0, 1.d0, trim(title)) call giza_set_character_height(chs) end subroutine draw_field_colorbar