8 module function cm_get_cmd(this) result(x)
10 class(colormap),
intent(in) :: this
11 character(len = :),
allocatable :: x
14 type(string_builder) :: str
20 call str%append(
"set palette defined (")
21 call str%append(this%get_color_string())
24 if (len(this%get_label()) > 0)
then
25 call str%append(new_line(
'a'))
26 call str%append(
'set cblabel "')
27 call str%append(this%get_label())
32 if (this%get_horizontal())
then
33 call str%append(new_line(
'a'))
34 call str%append(
"set colorbox horizontal")
35 call str%append(new_line(
'a'))
36 call str%append(
"set size 0.8,0.8; set origin 0.1,0.2")
37 call str%append(new_line(
'a'))
38 call str%append(
"set colorbox user origin 0.1,0.175 size 0.8,0.055")
40 if (len(this%get_label()) > 0)
then
41 call str%append(new_line(
'a'))
42 call str%append(
"set cblabel offset 0,0.8")
47 if (.not.this%get_draw_border())
then
49 call str%append(new_line(
'a'))
50 call str%append(
"set colorbox noborder")
53 call str%append(new_line(
'a'))
54 call str%append(
"set cbtic scale 0")
57 if (.not.this%get_show_tics())
then
58 call str%append(new_line(
'a'))
59 call str%append(
"set cbtic scale 0")
64 x = char(str%to_string())
68 pure module function cm_get_label(this) result(rst)
69 class(colormap),
intent(in) :: this
70 character(len = :),
allocatable :: rst
71 if (
allocated(this%m_label))
then
79 module subroutine cm_set_label(this, x)
80 class(colormap),
intent(inout) :: this
81 character(len = *),
intent(in) :: x
86 pure module function cm_get_horizontal(this) result(rst)
87 class(colormap),
intent(in) :: this
89 rst = this%m_horizontal
93 module subroutine cm_set_horizontal(this, x)
94 class(colormap),
intent(inout) :: this
95 logical,
intent(in) :: x
100 pure module function cm_get_draw_border(this) result(rst)
101 class(colormap),
intent(in) :: this
103 rst = this%m_drawBorder
107 module subroutine cm_set_draw_border(this, x)
108 class(colormap),
intent(inout) :: this
109 logical,
intent(in) :: x
110 this%m_drawBorder = x
114 pure module function cm_get_show_tics(this) result(rst)
115 class(colormap),
intent(in) :: this
117 rst = this%m_showTics
121 module subroutine cm_set_show_tics(this, x)
122 class(colormap),
intent(inout) :: this
123 logical,
intent(in) :: x
134 module function rcm_get_clr(this) result(x)
135 class(rainbow_colormap),
intent(in) :: this
136 character(len = :),
allocatable :: x
137 x =
'0 "dark-blue", 1 "blue", 2 "cyan", 3 "green", 4 "yellow", ' // &
138 '5 "orange", 6 "red", 7 "dark-red"'
144 module function hcm_get_clr(this) result(x)
145 class(hot_colormap),
intent(in) :: this
146 character(len = :),
allocatable :: x
147 x =
'0 "black", 1 "red", 2 "orange", 3 "yellow", 4 "white"'
153 module function ccm_get_clr(this) result(x)
154 class(cool_colormap),
intent(in) :: this
155 character(len = :),
allocatable :: x
157 type(string_builder) :: str
159 call str%append(
"0 '#08589E',")
160 call str%append(
"1 '#2B8CBE',")
161 call str%append(
"2 '#4EB3D3',")
162 call str%append(
"3 '#7BCCC4',")
163 call str%append(
"4 '#A8DDB5',")
164 call str%append(
"5 '#CCEBC5',")
165 call str%append(
"6 '#E0F3DB',")
166 call str%append(
"7 '#F7FCF0'")
168 x = char(str%to_string())
175 module function pcm_get_clr(this) result(x)
176 class(parula_colormap),
intent(in) :: this
177 character(len = :),
allocatable :: x
179 type(string_builder) :: str
181 call str%append(
"0 '#352a87',")
182 call str%append(
"1 '#0363e1',")
183 call str%append(
"2 '#1485d4',")
184 call str%append(
"3 '#06a7c6',")
185 call str%append(
"4 '#38b99e',")
186 call str%append(
"5 '#92bf73',")
187 call str%append(
"6 '#d9ba56',")
188 call str%append(
"7 '#fcce2e',")
189 call str%append(
"8 '#f9fb0e'")
191 x = char(str%to_string())
197 module function gcm_get_clr(this) result(x)
198 class(grey_colormap),
intent(in) :: this
199 character(len = :),
allocatable :: x
201 type(string_builder) :: str
203 call str%append(
"0 '#FFFFFF',")
204 call str%append(
"1 '#F0F0F0',")
205 call str%append(
"2 '#D9D9D9',")
206 call str%append(
"3 '#BDBDBD',")
207 call str%append(
"4 '#969696',")
208 call str%append(
"5 '#737373',")
209 call str%append(
"6 '#525252',")
210 call str%append(
"7 '#252525'")
212 x = char(str%to_string())
218 module function ecm_get_clr(this) result(x)
219 class(earth_colormap),
intent(in) :: this
220 character(len = :),
allocatable :: x
222 type(string_builder) :: str
224 call str%append(
"0 '#8C510A',")
225 call str%append(
"1 '#BF812D',")
226 call str%append(
"2 '#DFC27D',")
227 call str%append(
"3 '#F6E8C3',")
228 call str%append(
"4 '#D9F0D3',")
229 call str%append(
"5 '#A6DBA0',")
230 call str%append(
"6 '#5AAE61',")
231 call str%append(
"7 '#1B7837'")
233 x = char(str%to_string())
243 module function custom_get_clr(this) result(x)
244 class(custom_colormap),
intent(in) :: this
245 character(len = :),
allocatable :: x
247 type(string_builder) :: str
248 integer(int32) :: i, n, r, g, b
251 if (.not.
associated(this%m_map))
then
252 allocate(
character(len = 0) :: x)
256 n = this%m_map%get_levels()
259 call this%m_map%get_RGB(i, clr%red, clr%green, clr%blue)
262 call str%append(to_string(i))
263 call str%append(
" '#")
264 call str%append(clr%to_hex_string())
271 x = char(str%to_string())
275 module subroutine custom_set(this, map, err)
277 class(custom_colormap),
intent(inout) :: this
278 class(cmap),
intent(in) :: map
279 class(errors),
intent(inout),
optional,
target :: err
282 integer(int32) :: flag
283 class(errors),
pointer :: errmgr
284 type(errors),
target :: deferr
287 if (
present(err))
then
294 if (
associated(this%m_map))
deallocate(this%m_map)
295 allocate(this%m_map, source = map, stat = flag)
297 call errmgr%report_error(
"custom_init", &
298 "Memory allocation error code " // char(to_string(flag)) //
".", &
299 plot_out_of_memory_error)
305 module function custom_get(this) result(rst)
306 class(custom_colormap),
intent(in) :: this
307 class(cmap),
pointer :: rst
312 module subroutine custom_final(this)
313 type(custom_colormap),
intent(inout) :: this
314 if (
associated(this%m_map))
then
315 deallocate(this%m_map)