Return colour of colormap name at t.
t clamped to [0, 1], unknown names fall back to teal. _r reversal is done by
axes%colormap, not here.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | name |
Colormap name, a |
||
| real(kind=real64), | intent(in) | :: | t |
Position along map, 0 at low end, 1 at high end. |
||
| real(kind=real64), | intent(out) | :: | r |
Red, in [0, 1]. |
||
| real(kind=real64), | intent(out) | :: | g |
Green, in [0, 1]. |
||
| real(kind=real64), | intent(out) | :: | b |
Blue, in [0, 1]. |
pure subroutine cmap_rgb(name, t, r, g, b) !! Return colour of colormap `name` at `t`. !! !! `t` clamped to [0, 1], unknown names fall back to `teal`. `_r` reversal is done by !! `axes%colormap`, not here. ! Arguments character(len=*), intent(in) :: name !! Colormap name, a `CMAP_NAMES` entry. real(real64), intent(in) :: t !! Position along map, 0 at low end, 1 at high end. real(real64), intent(out) :: r !! Red, in [0, 1]. real(real64), intent(out) :: g !! Green, in [0, 1]. real(real64), intent(out) :: b !! Blue, in [0, 1]. real(real64) :: x x = min(max(t, 0.d0), 1.d0) select case (name) case ('blue') ! the exact epsnuc gain ramp r = 1.d0 - 0.85d0*x; g = r; b = 1.d0 case ('gray') r = 1.d0 - x; g = r; b = r case ('viridis') call interp(VIRIDIS, x, r, g, b) case ('plasma') call interp(PLASMA, x, r, g, b) case ('inferno') call interp(INFERNO, x, r, g, b) case ('magma') call interp(MAGMA, x, r, g, b) case ('cividis') call interp(CIVIDIS, x, r, g, b) case ('Greys') call interp(GREYS, x, r, g, b) case ('Blues') call interp(BLUES, x, r, g, b) case ('Greens') call interp(GREENS, x, r, g, b) case ('Reds') call interp(REDS, x, r, g, b) case ('Purples') call interp(PURPLES, x, r, g, b) case ('Oranges') call interp(ORANGES, x, r, g, b) case ('coolwarm') call interp(COOLWARM, x, r, g, b) case ('RdBu') call interp(RDBU, x, r, g, b) case ('turbo') call interp(TURBO, x, r, g, b) case default ! 'teal': white -> teal-blue r = 1.d0 + x*(0.09d0 - 1.d0) g = 1.d0 + x*(0.42d0 - 1.d0) b = 1.d0 + x*(0.67d0 - 1.d0) end select end subroutine cmap_rgb