6pure module function pdb_get_count(this) result(x)
7 class(plot_data_bar),
intent(in) :: this
9 if (
allocated(this%m_barData))
then
10 x =
size(this%m_barData, 1)
17pure module function pdb_get_data(this, index, col) result(x)
18 class(plot_data_bar),
intent(in) :: this
19 integer(int32),
intent(in) :: index, col
21 if (
allocated(this%m_barData))
then
22 x = this%m_barData(index, col)
29module subroutine pdb_set_data(this, index, col, x)
30 class(plot_data_bar),
intent(inout) :: this
31 integer(int32),
intent(in) :: index, col
32 real(real64),
intent(in) :: x
33 if (
allocated(this%m_barData))
then
34 this%m_barData(index, col) = x
39pure module function pdb_get_data_set(this, col) result(x)
40 class(plot_data_bar),
intent(in) :: this
41 integer(int32),
intent(in) :: col
42 real(real64),
allocatable,
dimension(:) :: x
43 if (
allocated(this%m_barData))
then
44 x = this%m_barData(:,col)
51pure module function pdb_get_label(this, index) result(x)
52 class(plot_data_bar),
intent(in) :: this
53 integer(int32),
intent(in) :: index
54 character(len = :),
allocatable :: x
55 if (
allocated(this%m_axisLabels))
then
56 x = char(this%m_axisLabels(index))
63module subroutine pdb_set_label(this, index, txt)
64 class(plot_data_bar),
intent(inout) :: this
65 integer(int32) :: index
66 character(len = *),
intent(in) :: txt
67 if (
allocated(this%m_axisLabels))
then
68 this%m_axisLabels(index) = txt
73pure module function pdb_get_use_labels(this) result(x)
74 class(plot_data_bar),
intent(in) :: this
76 x = this%m_useAxisLabels
80module subroutine pdb_set_use_labels(this, x)
81 class(plot_data_bar),
intent(inout) :: this
82 logical,
intent(in) :: x
83 this%m_useAxisLabels = x
87module function pdb_get_cmd(this) result(x)
89 class(plot_data_bar),
intent(in) :: this
90 character(len = :),
allocatable :: x
93 type(string_builder) :: str
94 integer(int32) :: n, ncols
101 call str%append(
' "-" ')
104 if (this%get_use_labels() .and.
allocated(this%m_barData) .and. &
105 allocated(this%m_axisLabels))
then
106 ncols =
size(this%m_barData, 2)
108 call str%append(
" using 2:xtic(1) ")
110 call str%append(
" using 2:")
111 call str%append(to_string(ncols))
112 call str%append(
":xtic(1) ")
117 call str%append(
" with boxes ")
120 if (this%get_is_filled())
then
121 call str%append(
" fill solid ")
123 call str%append(
" fill empty ")
127 call str%append(to_string(this%get_transparency()))
130 n = len_trim(this%get_name())
132 call str%append(
' title "')
133 call str%append(this%get_name())
136 call str%append(
' notitle')
140 clr = this%get_line_color()
141 call str%append(
' lc rgb "#')
142 call str%append(clr%to_hex_string())
147 call str%append(this%get_axes_string())
150 x = char(str%to_string())
154module function pdb_get_data_cmd(this) result(x)
156 class(plot_data_bar),
intent(in) :: this
157 character(len = :),
allocatable :: x
160 type(string_builder) :: str
161 integer(int32) :: i, j, nbars, ncols
162 character :: delimiter, nl
165 call str%initialize()
168 nbars = this%get_count()
169 ncols = this%get_bar_per_label_count()
172 if (this%get_use_labels() .and.
allocated(this%m_axisLabels) .and. &
173 allocated(this%m_barData))
then
175 call str%append(char(this%m_axisLabels(i)))
176 call str%append(delimiter)
178 call str%append(to_string(this%get(i, j)))
179 if (j /= nbars)
call str%append(delimiter)
186 call str%append(to_string(this%get(i, j)))
187 if (j /= nbars)
call str%append(delimiter)
194 x = char(str%to_string())
198module function pdb_get_axes_cmd(this) result(x)
200 class(plot_data_bar),
intent(in) :: this
201 character(len = :),
allocatable :: x
204 if (this%get_draw_against_y2())
then
212pure module function pdb_get_col_count(this) result(x)
213 class(plot_data_bar),
intent(in) :: this
215 if (
allocated(this%m_barData))
then
216 x =
size(this%m_barData, 2)
223pure module function pdb_get_use_y2(this) result(x)
224 class(plot_data_bar),
intent(in) :: this
230module subroutine pdb_set_use_y2(this, x)
231 class(plot_data_bar),
intent(inout) :: this
232 logical,
intent(in) :: x
237module subroutine pdb_set_data_1(this, x, err)
239 class(plot_data_bar),
intent(inout) :: this
240 real(real64),
intent(in),
dimension(:) :: x
241 class(errors),
intent(inout),
optional,
target :: err
244 call this%set_data_1(x, err)
248module subroutine pdb_set_data_2(this, labels, x, err)
250 class(plot_data_bar),
intent(inout) :: this
251 class(string),
intent(in),
dimension(:) :: labels
252 real(real64),
intent(in),
dimension(:) :: x
253 class(errors),
intent(inout),
optional,
target :: err
256 call this%set_data_2(labels, x, err)
260module subroutine pdb_set_data_3(this, labels, x, fmt, err)
262 class(plot_data_bar),
intent(inout) :: this
263 real(real64),
intent(in),
dimension(:) :: labels
264 real(real64),
intent(in),
dimension(:) :: x
265 character(len = *),
intent(in),
optional :: fmt
266 class(errors),
intent(inout),
optional,
target :: err
269 call this%set_data_3(labels, x, fmt, err)
273pure module function pdb_get_is_filled(this) result(x)
274 class(plot_data_bar),
intent(in) :: this
280module subroutine pdb_set_is_filled(this, x)
281 class(plot_data_bar),
intent(inout) :: this
282 logical,
intent(in) :: x
287pure module function pdb_get_alpha(this) result(x)
288 class(plot_data_bar),
intent(in) :: this
294module subroutine pdb_set_alpha(this, x)
295 class(plot_data_bar),
intent(inout) :: this
296 real(real32),
intent(in) :: x
299 else if (x < 0.0)
then
307module subroutine pdb_set_data_1_core(this, x, err)
309 class(plot_data_bar),
intent(inout) :: this
310 real(real64),
intent(in),
dimension(:) :: x
311 class(errors),
intent(inout),
optional,
target :: err
314 class(errors),
pointer :: errmgr
315 type(errors),
target :: deferr
316 integer(int32) :: n, flag
319 if (
present(err))
then
327 if (
allocated(this%m_axisLabels))
deallocate(this%m_axisLabels)
328 if (
allocated(this%m_barData))
deallocate(this%m_barData)
329 allocate(this%m_barData(n, 1), stat = flag)
331 call errmgr%report_error(
"pdb_set_data_1_core", &
332 "Insufficient memory available.", plot_out_of_memory_error)
335 this%m_barData(:,1) = x
339module subroutine pdb_set_data_2_core(this, labels, x, err)
341 class(plot_data_bar),
intent(inout) :: this
342 class(string),
intent(in),
dimension(:) :: labels
343 real(real64),
intent(in),
dimension(:) :: x
344 class(errors),
intent(inout),
optional,
target :: err
347 class(errors),
pointer :: errmgr
348 type(errors),
target :: deferr
349 integer(int32) :: n, flag
352 if (
present(err))
then
360 if (
size(labels) /= n)
then
361 call errmgr%report_error(
"pdb_set_data_2_core", &
362 "The input arrays are not the same size.", &
363 plot_array_size_mismatch_error)
368 if (
allocated(this%m_axisLabels))
deallocate(this%m_axisLabels)
369 if (
allocated(this%m_barData))
deallocate(this%m_barData)
370 allocate(this%m_barData(n, 1), stat = flag)
371 if (flag == 0)
allocate(this%m_axisLabels(n), stat = flag)
373 call errmgr%report_error(
"pdb_set_data_2_core", &
374 "Insufficient memory available.", plot_out_of_memory_error)
377 this%m_barData(:,1) = x
378 this%m_axisLabels = labels
382module subroutine pdb_set_data_3_core(this, labels, x, fmt, err)
384 class(plot_data_bar),
intent(inout) :: this
385 real(real64),
intent(in),
dimension(:) :: labels
386 real(real64),
intent(in),
dimension(:) :: x
387 character(len = *),
intent(in),
optional :: fmt
388 class(errors),
intent(inout),
optional,
target :: err
391 class(errors),
pointer :: errmgr
392 type(errors),
target :: deferr
393 integer(int32) :: i, n, flag
394 type(string),
allocatable,
dimension(:) :: lbls
397 if (
present(err))
then
405 if (
size(labels) /= n)
then
406 call errmgr%report_error(
"pdb_set_data_3_core", &
407 "The input arrays are not the same size.", &
408 plot_array_size_mismatch_error)
413 allocate(lbls(n), stat = flag)
415 call errmgr%report_error(
"pdb_set_data_3_core", &
416 "Insufficient memory available.", plot_out_of_memory_error)
420 lbls(i) = to_string(labels(i), fmt)
424 if (
allocated(this%m_axisLabels))
deallocate(this%m_axisLabels)
425 if (
allocated(this%m_barData))
deallocate(this%m_barData)
426 allocate(this%m_barData(n, 1), stat = flag)
427 if (flag == 0)
allocate(this%m_axisLabels(n), stat = flag)
429 call errmgr%report_error(
"pdb_set_data_3_core", &
430 "Insufficient memory available.", plot_out_of_memory_error)
433 this%m_barData(:,1) = x
434 this%m_axisLabels = lbls