Skip to content

Commit

Permalink
Added comments about create methods
Browse files Browse the repository at this point in the history
  • Loading branch information
vmagnin committed Mar 2, 2024
1 parent f579ce1 commit 0fd60d4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
6 changes: 4 additions & 2 deletions example/demo.f90
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ program demo
shape(my_colormap), order = [2, 1] )
!> You can create your own colormap using that array. The name of your
!> colormap must conform to the max length defined in colormap_parameters.f90
!> Use the create() method instead of the set() method.
call custom_cmap%create('red_cabbage', 0.0_wp, 2.0_wp, my_colormap)
call custom_cmap%colorbar('red_cabbage_colorbar')
call test_colormap(custom_cmap, 'red_cabbage_test')
Expand All @@ -63,13 +64,14 @@ program demo
print '("Colormap ", A30, " has ", I0, " levels")', trim(cmap%get_name()), cmap%get_levels()
end do

! Cubehelix can also accept other parameters (varargs array):
!> Cubehelix can also accept other parameters (varargs array):
call cmap%set("cubehelix", 0.0_wp, 2.0_wp, 1024, [0.5_wp, -1.0_wp, 1.0_wp, 1.0_wp])
! We change the name for the output test files:
call cmap%colorbar('cubehelix_customized_colorbar')
call test_colormap(cmap, 'cubehelix_customized_test')

! Or you can download it from a .txt file:
!> Or you can download it from a .txt file.
!> Use the load() method instead of the set() method.
call custom_cmap%load("test_map_to_load.txt", 0.0_wp, 2.0_wp)
call custom_cmap%colorbar('a_loaded_colorbar')
call test_colormap(custom_cmap, 'a_loaded_colormap_test')
Expand Down
6 changes: 4 additions & 2 deletions example/demo_reverse.f90
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ program demo_reverse
shape(my_colormap), order = [2, 1] )
!> You can create your own colormap using that array. The name of your
!> colormap must conform to the max length defined in colormap_parameters.f90
!> Use the create() method instead of the set() method.
call custom_cmap%create('red_cabbage_reverse', 0.0_wp, 2.0_wp, my_colormap, reverse=.true.)
call custom_cmap%colorbar('red_cabbage_reverse_colorbar')
call test_colormap(custom_cmap, 'red_cabbage_reverse_test')
Expand All @@ -61,13 +62,14 @@ program demo_reverse
print '("Colormap ", A30, " has ", I0, " levels")', trim(cmap%get_name()), cmap%get_levels()
end do

! Cubehelix can also accept other parameters (varargs array):
!> Cubehelix can also accept other parameters (varargs array):
call cmap%set("cubehelix", 0.0_wp, 2.0_wp, 1024, [0.5_wp, -1.0_wp, 1.0_wp, 1.0_wp], reverse=.true.)
! We change the name for the output test files:
call cmap%colorbar('cubehelix_customized_reverse_colorbar')
call test_colormap(cmap, 'cubehelix_customized_reverse_test')

! Or you can download it from a .txt file:
!> Or you can download it from a .txt file.
!> Use the load() method instead of the set() method.
call custom_cmap%load("test_map_to_load.txt", 0.0_wp, 2.0_wp, reverse=.true.)
call custom_cmap%colorbar('a_loaded_reverse_colorbar')
call test_colormap(custom_cmap, 'a_loaded_reverse_colormap_test')
Expand Down
7 changes: 3 additions & 4 deletions src/colormap_class.f90
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ pure subroutine set(self, name, zmin, zmax, levels, varargs, reverse)
end if
end subroutine set

! You can create a custom colormap:
!> You can create a custom colormap from a "map" array.
pure subroutine create(self, name, zmin, zmax, map, reverse)
class(Colormap), intent(inout) :: self
character(*), intent(in) :: name
Expand Down Expand Up @@ -618,8 +618,7 @@ pure subroutine create(self, name, zmin, zmax, map, reverse)
end if
end subroutine


! You can create a custom colormap:
!> You can create a custom colormap using Lagrange interpolation:
pure subroutine create_lagrange(self, name, zmin, zmax, colors, levels, reverse)
class(Colormap), intent(inout) :: self
character(*), intent(in) :: name
Expand Down Expand Up @@ -652,7 +651,7 @@ pure subroutine create_lagrange(self, name, zmin, zmax, colors, levels, reverse)
end if
end subroutine

! You can create a custom colormap:
!> You can create a custom colormap using Bezier interpolation:
pure subroutine create_bezier(self, name, zmin, zmax, colors, levels, reverse)
class(Colormap), intent(inout) :: self
character(*), intent(in) :: name
Expand Down

0 comments on commit 0fd60d4

Please sign in to comment.