@@ -31,6 +31,10 @@ module fplot_plot_data_box_whisker
3131 ! ! The line width.
3232 real (real32), private :: m_boxWidth = 0.05
3333 ! ! The box width.
34+ logical , private :: m_fillBoxes = .true.
35+ ! ! Fill the boxes?
36+ real (real32), private :: m_boxOpacity = 1.0
37+ ! ! Box opacity [0, 1.0].
3438 contains
3539 procedure , public :: define_data = > pdbw_define_data_xstring
3640 procedure , public :: get_command_string = > pdbw_get_cmd
@@ -45,6 +49,10 @@ module fplot_plot_data_box_whisker
4549 procedure , public :: set_line_width = > pdbw_set_line_width
4650 procedure , public :: get_box_width = > pdbw_get_box_width
4751 procedure , public :: set_box_width = > pdbw_set_box_width
52+ procedure , public :: get_fill_boxes = > pdbw_get_fill_boxes
53+ procedure , public :: set_fill_boxes = > pdbw_set_fill_boxes
54+ procedure , public :: get_box_fill_opacity = > pdbw_get_opacity
55+ procedure , public :: set_box_fill_opacity = > pdbw_set_opacity
4856 end type
4957
5058contains
@@ -143,6 +151,13 @@ function pdbw_get_cmd(this) result(rst)
143151 call str% append (" lw " )
144152 call str% append (to_string(this% get_line_width()))
145153
154+ ! Fill Boxes
155+ if (this% get_fill_boxes()) then
156+ call str% append (" fill solid " )
157+ call str% append (to_string(this% get_box_fill_opacity()))
158+ call str% append (" border" )
159+ end if
160+
146161 ! End
147162 rst = char (str% to_string())
148163end function
@@ -295,7 +310,8 @@ subroutine pdbw_set_line_width(this, x)
295310
296311! ------------------------------------------------------------------------------
297312pure function pdbw_get_box_width (this ) result(rst)
298- ! ! Gets the box width.
313+ ! ! Gets the box width. By default the x-axis is incremented in units of 1;
314+ ! ! therefore, a box width of 1 will fully fill the space.
299315 class(plot_data_box_whisker), intent (in ) :: this
300316 ! ! The plot_data_box_whisker object.
301317 real (real32) :: rst
@@ -305,7 +321,8 @@ pure function pdbw_get_box_width(this) result(rst)
305321
306322! --------------------
307323subroutine pdbw_set_box_width (this , x )
308- ! ! Sets the box width.
324+ ! ! Sets the box width. By default the x-axis is incremented in units of 1;
325+ ! ! therefore, a box width of 1 will fully fill the space.
309326 class(plot_data_box_whisker), intent (inout ) :: this
310327 ! ! The plot_data_box_whisker object.
311328 real (real32), intent (in ) :: x
@@ -314,12 +331,44 @@ subroutine pdbw_set_box_width(this, x)
314331end subroutine
315332
316333! ------------------------------------------------------------------------------
334+ pure function pdbw_get_fill_boxes (this ) result(rst)
335+ ! ! Gets a value determining if the boxes should be filled.
336+ class(plot_data_box_whisker), intent (in ) :: this
337+ ! ! The plot_data_box_whisker object.
338+ logical :: rst
339+ ! ! True if the boxes are to be filled; else, false.
340+ rst = this% m_fillBoxes
341+ end function
317342
318343! --------------------
344+ subroutine pdbw_set_fill_boxes (this , x )
345+ ! ! Sets a value determining if the boxes should be filled.
346+ class(plot_data_box_whisker), intent (inout ) :: this
347+ ! ! The plot_data_box_whisker object.
348+ logical , intent (in ) :: x
349+ ! ! Set to true if the boxes are to be filled; else, false.
350+ this% m_fillBoxes = x
351+ end subroutine
319352
320353! ------------------------------------------------------------------------------
354+ pure function pdbw_get_opacity (this ) result(rst)
355+ ! ! Gets the opacity of the box fill color.
356+ class(plot_data_box_whisker), intent (in ) :: this
357+ ! ! The plot_data_box_whisker object.
358+ real (real32) :: rst
359+ ! ! The opacity on a scale from 0 to 1.
360+ rst = this% m_boxOpacity
361+ end function
321362
322363! --------------------
364+ subroutine pdbw_set_opacity (this , x )
365+ ! ! Sets the opacity of the box fill color.
366+ class(plot_data_box_whisker), intent (inout ) :: this
367+ ! ! The plot_data_box_whisker object.
368+ real (real32), intent (in ) :: x
369+ ! ! The opacity on a scale from 0 to 1.
370+ this% m_boxOpacity = x
371+ end subroutine
323372
324373! ------------------------------------------------------------------------------
325374end module
0 commit comments