6 module function pde_get_cmd(this) result(cmd)
8 class(plot_data_error_bars),
intent(in) :: this
9 character(len = :),
allocatable :: cmd
12 type(string_builder) :: str
20 n = len_trim(this%get_name())
22 call str%append(
' "-" title "')
23 call str%append(this%get_name())
26 call str%append(
' "-" notitle')
30 clr = this%get_line_color()
31 call str%append(
' lc rgb "#')
32 call str%append(clr%to_hex_string())
36 if (this%get_plot_x_error_bars() .and. this%get_plot_y_error_bars())
then
37 if (this%get_use_error_box())
then
38 call str%append(
" w boxxyerr")
40 call str%append(
" w xyerr")
42 else if (this%get_plot_x_error_bars() .and. .not.this%get_plot_y_error_bars())
then
43 call str%append(
" w xerr")
44 else if (.not.this%get_plot_x_error_bars() .and. this%get_plot_y_error_bars())
then
45 call str%append(
" w yerr")
49 cmd = char(str%to_string())
53 module function pde_get_data_cmd(this) result(cmd)
55 class(plot_data_error_bars),
intent(in) :: this
56 character(len = :),
allocatable :: cmd
59 type(string_builder) :: str
60 integer(int32) :: i, n
61 character :: delimiter, nl
70 if (this%get_plot_x_error_bars() .and. this%get_plot_y_error_bars())
then
71 if (this%get_use_range())
then
73 call str%append(to_string(this%m_data(i, 1)))
74 call str%append(delimiter)
75 call str%append(to_string(this%m_data(i, 2)))
76 call str%append(delimiter)
77 call str%append(to_string(this%m_data(i, 3)))
78 call str%append(delimiter)
79 call str%append(to_string(this%m_data(i, 4)))
80 call str%append(delimiter)
81 call str%append(to_string(this%m_data(i, 5)))
82 call str%append(delimiter)
83 call str%append(to_string(this%m_data(i, 6)))
88 call str%append(to_string(this%m_data(i, 1)))
89 call str%append(delimiter)
90 call str%append(to_string(this%m_data(i, 2)))
91 call str%append(delimiter)
92 call str%append(to_string(this%m_data(i, 3)))
93 call str%append(delimiter)
94 call str%append(to_string(this%m_data(i, 4)))
99 if (this%get_use_range())
then
101 call str%append(to_string(this%m_data(i, 1)))
102 call str%append(delimiter)
103 call str%append(to_string(this%m_data(i, 2)))
104 call str%append(delimiter)
105 call str%append(to_string(this%m_data(i, 3)))
106 call str%append(delimiter)
107 call str%append(to_string(this%m_data(i, 4)))
112 call str%append(to_string(this%m_data(i, 1)))
113 call str%append(delimiter)
114 call str%append(to_string(this%m_data(i, 2)))
115 call str%append(delimiter)
116 call str%append(to_string(this%m_data(i, 3)))
145 cmd = char(str%to_string())
149 module subroutine pde_define_x_err(this, x, y, xerr, err)
151 class(plot_data_error_bars),
intent(inout) :: this
152 real(real64),
intent(in),
dimension(:) :: x, y, xerr
153 class(errors),
intent(inout),
optional,
target :: err
156 integer(int32) :: i, n, flag
157 class(errors),
pointer :: errmgr
158 type(errors),
target :: deferr
162 if (
present(err))
then
169 if (
size(y) /= n .or.
size(xerr) /= n)
then
170 call errmgr%report_error(
"pde_define_x_err", &
171 "Input arrays must be the same size.", &
172 plot_array_size_mismatch_error)
177 this%m_xBars = .false.
178 this%m_yBars = .false.
179 this%m_range = .false.
180 if (
allocated(this%m_data))
deallocate(this%m_data)
181 allocate(this%m_data(n, 3), stat = flag)
183 call errmgr%report_error(
"pde_define_x_err", &
184 "Insufficient memory available.", plot_out_of_memory_error)
188 this%m_data(i, 1) = x(i)
189 this%m_data(i, 2) = y(i)
190 this%m_data(i, 3) = xerr(i)
192 this%m_xBars = .true.
193 this%m_range = .false.
197 module subroutine pde_define_y_err(this, x, y, yerr, err)
199 class(plot_data_error_bars),
intent(inout) :: this
200 real(real64),
intent(in),
dimension(:) :: x, y, yerr
201 class(errors),
intent(inout),
optional,
target :: err
204 integer(int32) :: i, n, flag
205 class(errors),
pointer :: errmgr
206 type(errors),
target :: deferr
210 if (
present(err))
then
217 if (
size(y) /= n .or.
size(yerr) /= n)
then
218 call errmgr%report_error(
"pde_define_y_err", &
219 "Input arrays must be the same size.", &
220 plot_array_size_mismatch_error)
225 this%m_xBars = .false.
226 this%m_yBars = .false.
227 this%m_range = .false.
228 if (
allocated(this%m_data))
deallocate(this%m_data)
229 allocate(this%m_data(n, 3), stat = flag)
231 call errmgr%report_error(
"pde_define_y_err", &
232 "Insufficient memory available.", plot_out_of_memory_error)
236 this%m_data(i, 1) = x(i)
237 this%m_data(i, 2) = y(i)
238 this%m_data(i, 3) = yerr(i)
240 this%m_yBars = .true.
241 this%m_range = .false.
245 module subroutine pde_define_xy_err(this, x, y, xerr, yerr, err)
247 class(plot_data_error_bars),
intent(inout) :: this
248 real(real64),
intent(in),
dimension(:) :: x, y, xerr, yerr
249 class(errors),
intent(inout),
optional,
target :: err
252 integer(int32) :: i, n, flag
253 class(errors),
pointer :: errmgr
254 type(errors),
target :: deferr
258 if (
present(err))
then
265 if (
size(y) /= n .or.
size(xerr) /= n .or.
size(yerr) /= n)
then
266 call errmgr%report_error(
"pde_define_xy_err", &
267 "Input arrays must be the same size.", &
268 plot_array_size_mismatch_error)
273 this%m_xBars = .false.
274 this%m_yBars = .false.
275 this%m_range = .false.
276 if (
allocated(this%m_data))
deallocate(this%m_data)
277 allocate(this%m_data(n, 4), stat = flag)
279 call errmgr%report_error(
"pde_define_xy_err", &
280 "Insufficient memory available.", plot_out_of_memory_error)
284 this%m_data(i, 1) = x(i)
285 this%m_data(i, 2) = y(i)
286 this%m_data(i, 3) = xerr(i)
287 this%m_data(i, 4) = yerr(i)
289 this%m_xBars = .true.
290 this%m_yBars = .true.
291 this%m_range = .false.
295 pure module function pde_get_plot_x_err(this) result(x)
296 class(plot_data_error_bars),
intent(in) :: this
302 pure module function pde_get_plot_y_err(this) result(x)
303 class(plot_data_error_bars),
intent(in) :: this
308 pure module function pde_get_count(this) result(x)
309 class(plot_data_error_bars),
intent(in) :: this
311 if (
allocated(this%m_data))
then
312 x =
size(this%m_data, 1)
319 pure module function pde_get_box(this) result(x)
320 class(plot_data_error_bars),
intent(in) :: this
326 module subroutine pde_set_box(this, x)
327 class(plot_data_error_bars),
intent(inout) :: this
328 logical,
intent(in) :: x
333 pure module function pde_get_use_range(this) result(x)
334 class(plot_data_error_bars),
intent(in) :: this
340 module subroutine pde_define_x_err_lim(this, x, y, xmin, xmax, err)
342 class(plot_data_error_bars),
intent(inout) :: this
343 real(real64),
intent(in),
dimension(:) :: x, y, xmin, xmax
344 class(errors),
intent(inout),
optional,
target :: err
347 integer(int32) :: i, n, flag
348 class(errors),
pointer :: errmgr
349 type(errors),
target :: deferr
353 if (
present(err))
then
360 if (
size(y) /= n .or.
size(xmin) /= n .or.
size(xmax) /= n)
then
361 call errmgr%report_error(
"pde_define_x_err_lim", &
362 "Input arrays must be the same size.", &
363 plot_array_size_mismatch_error)
368 this%m_xBars = .false.
369 this%m_yBars = .false.
370 this%m_range = .false.
371 if (
allocated(this%m_data))
deallocate(this%m_data)
372 allocate(this%m_data(n, 4), stat = flag)
374 call errmgr%report_error(
"pde_define_x_err_lim", &
375 "Insufficient memory available.", plot_out_of_memory_error)
379 this%m_data(i, 1) = x(i)
380 this%m_data(i, 2) = y(i)
381 this%m_data(i, 3) = xmin(i)
382 this%m_data(i, 4) = xmax(i)
384 this%m_xBars = .true.
385 this%m_range = .true.
389 module subroutine pde_define_y_err_lim(this, x, y, ymin, ymax, err)
391 class(plot_data_error_bars),
intent(inout) :: this
392 real(real64),
intent(in),
dimension(:) :: x, y, ymin, ymax
393 class(errors),
intent(inout),
optional,
target :: err
396 integer(int32) :: i, n, flag
397 class(errors),
pointer :: errmgr
398 type(errors),
target :: deferr
402 if (
present(err))
then
409 if (
size(y) /= n .or.
size(ymin) /= n .or.
size(ymax) /= n)
then
410 call errmgr%report_error(
"pde_define_y_err_lim", &
411 "Input arrays must be the same size.", &
412 plot_array_size_mismatch_error)
417 this%m_xBars = .false.
418 this%m_yBars = .false.
419 this%m_range = .false.
420 if (
allocated(this%m_data))
deallocate(this%m_data)
421 allocate(this%m_data(n, 4), stat = flag)
423 call errmgr%report_error(
"pde_define_y_err_lim", &
424 "Insufficient memory available.", plot_out_of_memory_error)
428 this%m_data(i, 1) = x(i)
429 this%m_data(i, 2) = y(i)
430 this%m_data(i, 3) = ymin(i)
431 this%m_data(i, 4) = ymax(i)
433 this%m_yBars = .true.
434 this%m_range = .true.
437 module subroutine pde_define_xy_err_lim(this, x, y, xmin, xmax, ymin, ymax, err)
439 class(plot_data_error_bars),
intent(inout) :: this
440 real(real64),
intent(in),
dimension(:) :: x, y, xmin, xmax, &
442 class(errors),
intent(inout),
optional,
target :: err
445 integer(int32) :: i, n, flag
446 class(errors),
pointer :: errmgr
447 type(errors),
target :: deferr
451 if (
present(err))
then
458 if (
size(y) /= n .or.
size(ymin) /= n .or.
size(ymax) /= n)
then
459 call errmgr%report_error(
"pde_define_xy_err_lim", &
460 "Input arrays must be the same size.", &
461 plot_array_size_mismatch_error)
466 this%m_xBars = .false.
467 this%m_yBars = .false.
468 this%m_range = .false.
469 if (
allocated(this%m_data))
deallocate(this%m_data)
470 allocate(this%m_data(n, 6), stat = flag)
472 call errmgr%report_error(
"pde_define_xy_err_lim", &
473 "Insufficient memory available.", plot_out_of_memory_error)
477 this%m_data(i, 1) = x(i)
478 this%m_data(i, 2) = y(i)
479 this%m_data(i, 3) = xmin(i)
480 this%m_data(i, 4) = xmax(i)
481 this%m_data(i, 5) = ymin(i)
482 this%m_data(i, 6) = ymax(i)
484 this%m_xBars = .true.
485 this%m_yBars = .true.
486 this%m_range = .true.