6pure module function pdh_get_bin_count(this) result(x)
7 class(plot_data_histogram),
intent(in) :: this
13module subroutine pdh_set_bin_count(this, x)
14 class(plot_data_histogram),
intent(inout) :: this
15 integer(int32),
intent(in) :: x
20module function pdh_bin_data(this, x, err) result(bx)
22 class(plot_data_histogram),
intent(in) :: this
23 real(real64),
intent(in),
dimension(:) :: x
24 class(errors),
intent(inout),
optional,
target :: err
25 real(real64),
allocatable,
dimension(:,:) :: bx
28 real(real64) :: maxX, minX, width, val
29 integer(int32) :: i, j, flag, n, nbins
30 real(real64),
allocatable,
dimension(:,:) :: ranges
31 class(errors),
pointer :: errmgr
32 type(errors),
target :: deferr
35 if (
present(err))
then
41 nbins = this%get_bin_count()
46 width = (maxx - minx) / (nbins - 1.0)
49 allocate(bx(nbins, 2), stat = flag)
50 if (flag == 0)
allocate(ranges(nbins, 2), stat = flag)
52 call errmgr%report_error(
"pdh_bin_data", &
53 "Insufficient memory available.", plot_out_of_memory_error)
59 ranges(1,:) = [minx, minx + width]
61 ranges(i,1) = ranges(i-1,2)
62 ranges(i,2) = ranges(i,1) + width
69 if ((val >= ranges(j,1)) .and. (val <= ranges(j,2)))
then
70 bx(j,1) = bx(j,1) + 1.0d0
77 bx(:,2) = 0.5d0 * (ranges(:,1) + ranges(:,2))
81pure module function pdh_get_extremes(this) result(x)
83 class(plot_data_histogram),
intent(in) :: this
84 real(real64),
dimension(2) :: x
87 integer(int32) :: i, j, nrows, ncols
88 real(real64) :: maxX, minX, val
92 nrows = this%get_count()
93 ncols = this%get_bar_per_label_count()
105 if (val > maxx) maxx = val
106 if (val < minx) minx = val
116module subroutine pdh_set_data_1(this, x, err)
118 class(plot_data_histogram),
intent(inout) :: this
119 real(real64),
intent(in),
dimension(:) :: x
120 class(errors),
intent(inout),
optional,
target :: err
123 real(real64),
allocatable,
dimension(:,:) :: bx
124 class(errors),
pointer :: errmgr
125 type(errors),
target :: deferr
128 if (
present(err))
then
135 bx = this%bin_data(x, errmgr)
136 if (errmgr%has_error_occurred())
return
140 call this%plot_data_bar%set_data_3(bx(:,2), bx(:,1), &
141 this%get_number_format(), errmgr)
145module subroutine pdh_set_data_2(this, labels, x, err)
147 class(plot_data_histogram),
intent(inout) :: this
148 class(string),
intent(in),
dimension(:) :: labels
149 real(real64),
intent(in),
dimension(:) :: x
150 class(errors),
intent(inout),
optional,
target :: err
153 real(real64),
allocatable,
dimension(:,:) :: bx
154 class(errors),
pointer :: errmgr
155 type(errors),
target :: deferr
158 if (
present(err))
then
165 if (
size(labels) /= this%get_bin_count())
then
166 call errmgr%report_error(
"pdh_set_data_2", &
167 "The labels array must be the same size as the number of bins.", &
168 plot_array_size_mismatch_error)
173 call this%plot_data_bar%set_data_2(labels, bx(:,1), errmgr)
177module subroutine pdh_set_data_3(this, labels, x, fmt, err)
179 class(plot_data_histogram),
intent(inout) :: this
180 real(real64),
intent(in),
dimension(:) :: labels
181 real(real64),
intent(in),
dimension(:) :: x
182 character(len = *),
intent(in),
optional :: fmt
183 class(errors),
intent(inout),
optional,
target :: err
186 real(real64),
allocatable,
dimension(:,:) :: bx
187 class(errors),
pointer :: errmgr
188 type(errors),
target :: deferr
191 if (
present(err))
then
198 if (
size(labels) /= this%get_bin_count())
then
199 call errmgr%report_error(
"pdh_set_data_3", &
200 "The labels array must be the same size as the number of bins.", &
201 plot_array_size_mismatch_error)
206 call this%plot_data_bar%set_data_3(labels, bx(:,1), fmt, errmgr)
210pure module function pdh_get_num_fmt(this) result(x)
211 class(plot_data_histogram),
intent(in) :: this
212 character(len = :),
allocatable :: x
213 if (
allocated(this%m_numberFmt))
then
221module subroutine pdh_set_num_fmt(this, x)
222 class(plot_data_histogram),
intent(inout) :: this
223 character(len = *),
intent(in) :: x