modify Program

Uses

  • program~~modify~~UsesGraph program~modify modify module~forcolormap forcolormap program~modify->module~forcolormap module~colormap_parameters colormap_parameters module~forcolormap->module~colormap_parameters module~matplotlib_colormaps matplotlib_colormaps module~forcolormap->module~matplotlib_colormaps module~miscellaneous_colormaps miscellaneous_colormaps module~forcolormap->module~miscellaneous_colormaps module~scientific_colour_maps scientific_colour_maps module~forcolormap->module~scientific_colour_maps iso_fortran_env iso_fortran_env module~colormap_parameters->iso_fortran_env module~matplotlib_colormaps->module~colormap_parameters module~miscellaneous_colormaps->module~colormap_parameters module~scientific_colour_maps->module~colormap_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. In the Scientific colour maps collection, all categorical colormaps begin with a dark colour, but a shift can be applied to begin with a brighter colour. Two levels towards left 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~check Colormap%check proc~set->proc~check proc~create Colormap%create proc~set->proc~create 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 proc~compute_rgb Colormap%compute_RGB proc~write_ppm_colorbar->proc~compute_rgb proc~get_zmax Colormap%get_zmax proc~write_ppm_colorbar->proc~get_zmax proc~get_zmin Colormap%get_zmin proc~write_ppm_colorbar->proc~get_zmin set_format set_format proc~write_ppm_colorbar->set_format set_pnm set_pnm proc~write_ppm_colorbar->set_pnm proc~get_levels~2 Colormaps_info%get_levels proc~check->proc~get_levels~2 proc~get_name~2 Colormaps_info%get_name proc~check->proc~get_name~2 proc~get_ncolormaps Colormaps_info%get_ncolormaps proc~check->proc~get_ncolormaps proc~set_all Colormaps_info%set_all proc~check->proc~set_all proc~get_rgb Colormap%get_RGB proc~compute_rgb->proc~get_rgb proc~create->proc~check proc~create->proc~reverse proc~set_info table%set_info proc~set_all->proc~set_info

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"

    !> In the Scientific colour maps collection, 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"

    !> 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