modify Program

Uses

  • program~~modify~~UsesGraph program~modify modify module~forcolormap forcolormap program~modify->module~forcolormap module~forcolormap_cm_matplotlib forcolormap_cm_matplotlib module~forcolormap->module~forcolormap_cm_matplotlib module~forcolormap_cm_miscellaneous forcolormap_cm_miscellaneous module~forcolormap->module~forcolormap_cm_miscellaneous module~forcolormap_cm_scientific forcolormap_cm_scientific module~forcolormap->module~forcolormap_cm_scientific module~forcolormap_info forcolormap_info module~forcolormap->module~forcolormap_info module~forcolormap_parameters forcolormap_parameters module~forcolormap->module~forcolormap_parameters module~forcolormap_utils forcolormap_utils module~forcolormap->module~forcolormap_utils module~forcolormap_cm_matplotlib->module~forcolormap_parameters module~forcolormap_cm_miscellaneous->module~forcolormap_parameters module~forcolormap_cm_scientific->module~forcolormap_parameters module~forcolormap_info->module~forcolormap_cm_matplotlib module~forcolormap_info->module~forcolormap_cm_miscellaneous module~forcolormap_info->module~forcolormap_cm_scientific module~forcolormap_info->module~forcolormap_parameters iso_fortran_env iso_fortran_env module~forcolormap_parameters->iso_fortran_env module~forcolormap_utils->module~forcolormap_parameters

This example shows how you can modify a colormap with methods like shift(), in concrete cases. In the Scientific colour maps collection, all cyclic colormaps have their bright part in the middle. But we can shift the dark part towards the center. And all categorical colormaps begin with a dark colour, but a shift can be applied to begin with a brighter colour. Two levels towards left Finally, starting from a diverging colormap, we can obtain what could be called a diverging multi-sequential colormap.


Calls

program~~modify~~CallsGraph program~modify modify proc~get_levels Colormap%get_levels program~modify->proc~get_levels proc~set Colormap%set program~modify->proc~set proc~shift Colormap%shift program~modify->proc~shift proc~write_ppm_colorbar Colormap%write_ppm_colorbar program~modify->proc~write_ppm_colorbar proc~assign_map Colormap%assign_map proc~set->proc~assign_map proc~check Colormap%check proc~set->proc~check proc~cubehelix_colormap cubehelix_colormap proc~set->proc~cubehelix_colormap proc~fire_colormap fire_colormap proc~set->proc~fire_colormap proc~inv_rainbow_colormap inv_rainbow_colormap proc~set->proc~inv_rainbow_colormap proc~rainbow_colormap rainbow_colormap proc~set->proc~rainbow_colormap proc~reverse Colormap%reverse proc~set->proc~reverse proc~zebra_colormap zebra_colormap proc~set->proc~zebra_colormap export_pnm export_pnm proc~write_ppm_colorbar->export_pnm get_format get_format proc~write_ppm_colorbar->get_format local local proc~write_ppm_colorbar->local proc~compute_rgb Colormap%compute_RGB proc~write_ppm_colorbar->proc~compute_rgb set_format set_format proc~write_ppm_colorbar->set_format set_pnm set_pnm proc~write_ppm_colorbar->set_pnm proc~find_index Colormaps_info%find_index proc~check->proc~find_index proc~get_levels~2 Colormaps_info%get_levels proc~check->proc~get_levels~2 proc~get_rgb Colormap%get_RGB proc~compute_rgb->proc~get_rgb proc~cubehelix_colormap->local

Variables

Type Attributes Name Initial
type(Colormap) :: cmap

Source Code

program modify
    use forcolormap, only: Colormap, wp

    implicit none
    type(Colormap) :: cmap

    !> In the Scientific colour maps collection, all cyclic colormaps have their
    !> bright part in the middle. But we can shift the dark part towards the
    !> center.
    call cmap%set("bamO", 0.0_wp, 2.0_wp)
    call cmap%colorbar("bamO")
    call cmap%shift(cmap%get_levels() / 2)
    call cmap%colorbar("bamO_shifted")
    print *, "See the bamO.ppm and bamO_shifted.ppm colorbars"

    !> And all categorical colormaps
    !> begin with a dark colour, but a shift can be applied to begin with a
    !> brighter colour.
    call cmap%set("actonS", 0.0_wp, 2.0_wp)
    call cmap%colorbar("actonS")
    call cmap%shift(+2)   !! Two levels towards left
    call cmap%colorbar("actonS_shifted")
    print *, "See the actonS.ppm and actonS_shifted.ppm colorbars"

    !> Finally, starting from a diverging colormap, we can obtain what could be called
    !> a diverging multi-sequential colormap.
    call cmap%set("bam", 0.0_wp, 2.0_wp)
    call cmap%colorbar("bam")
    call cmap%shift(cmap%get_levels() / 2)
    call cmap%colorbar("bam_shifted")
    print *, "See the bam.ppm and bam_shifted.ppm colorbars"

end program modify