@@ -70,6 +70,8 @@ module fplot_core
7070 public :: LEGEND_RIGHT
7171 public :: LEGEND_TOP
7272 public :: LEGEND_BOTTOM
73+ public :: LEGEND_ARRANGE_VERTICALLY
74+ public :: LEGEND_ARRANGE_HORIZONTALLY
7375 public :: POLAR_THETA_BOTTOM
7476 public :: POLAR_THETA_LEFT
7577 public :: POLAR_THETA_RIGHT
@@ -207,6 +209,12 @@ module fplot_core
207209 character (len = * ), parameter :: LEGEND_RIGHT = " right"
208210 ! > @brief Defines the legend should be placed at the bottom of the plot.
209211 character (len = * ), parameter :: LEGEND_BOTTOM = " bottom"
212+ ! > @brief Defines the legend should be arranged such that the column count
213+ ! ! is minimized.
214+ character (len = * ), parameter :: LEGEND_ARRANGE_VERTICALLY = " vertical"
215+ ! > @brief Defines the legend should be arranged such that the row count
216+ ! ! is minimized.
217+ character (len = * ), parameter :: LEGEND_ARRANGE_HORIZONTALLY = " horizontal"
210218
211219! ******************************************************************************
212220! POLAR PLOT CONSTANTS
@@ -2224,6 +2232,10 @@ module subroutine pa_set_tic_label_fmt(this, x)
22242232 character (len = 20 ) :: m_vertPosition = LEGEND_TOP
22252233 ! > Determines if the legend is visible.
22262234 logical :: m_show = .false.
2235+ ! > Determines the legend layout.
2236+ character (len = 20 ) :: m_layout = LEGEND_ARRANGE_VERTICALLY
2237+ ! > Opaque background?
2238+ logical :: m_opaque = .true.
22272239 contains
22282240 ! > @brief Gets a value determining if the legend should be drawn inside
22292241 ! ! the axes border (true), or outside the axes border (false).
@@ -2559,6 +2571,48 @@ module subroutine pa_set_tic_label_fmt(this, x)
25592571 ! ! @param[in] this The legend object.
25602572 ! ! @return The GNUPLOT command string.
25612573 procedure , public :: get_command_string = > leg_get_command_txt
2574+ ! > @brief Gets the layout of the legend.
2575+ ! !
2576+ ! ! @par Syntax
2577+ ! ! @code{.f90}
2578+ ! ! character(len = :) pure function get_layout(class(legend) this)
2579+ ! ! @endcode
2580+ ! !
2581+ ! ! @param[in] this The legend object.
2582+ ! ! @return The layout type, either @ref LEGEND_ARRANGE_VERTICALLY
2583+ ! ! or @ref LEGEND_ARRANGE_HORIZONTALLY.
2584+ procedure , public :: get_layout = > leg_get_layout
2585+ ! > @brief Sets the layout of the legend.
2586+ ! !
2587+ ! ! @par Syntax
2588+ ! ! @code{.f90}
2589+ ! ! subroutine set_layout(class(legend) this, character(len = *) x)
2590+ ! ! @endcode
2591+ ! !
2592+ ! ! @param[in,out] this The legend object.
2593+ ! ! @param[in] x The layout type, either @ref LEGEND_ARRANGE_VERTICALLY
2594+ ! ! or @ref LEGEND_ARRANGE_HORIZONTALLY.
2595+ procedure , public :: set_layout = > leg_set_layout
2596+ ! > @brief Gets a value determining if the legend is to be opaque.
2597+ ! !
2598+ ! ! @par Syntax
2599+ ! ! @code{.f90}
2600+ ! ! logical pure function get_is_opaque(class(legend) this)
2601+ ! ! @endcode
2602+ ! !
2603+ ! ! @param[in] this The legend object.
2604+ ! ! @return True if the legend is to be opaque; else, false.
2605+ procedure , public :: get_is_opaque = > leg_get_opaque
2606+ ! > @brief Sets a value determining if the legend is to be opaque.
2607+ ! !
2608+ ! ! @par Syntax
2609+ ! ! @code{.f90}
2610+ ! ! subroutine set_is_opaque(class(legend) this)
2611+ ! ! @endcode
2612+ ! !
2613+ ! ! @param[in,out] this The legend object.
2614+ ! ! @param[in] x True if the legend is to be opaque; else, false.
2615+ procedure , public :: set_is_opaque = > leg_set_opaque
25622616 end type
25632617
25642618! ------------------------------------------------------------------------------
@@ -2617,6 +2671,26 @@ module function leg_get_command_txt(this) result(txt)
26172671 class(legend), intent (in ) :: this
26182672 character (len = :), allocatable :: txt
26192673 end function
2674+
2675+ pure module function leg_get_layout(this) result(rst)
2676+ class(legend), intent (in ) :: this
2677+ character (len = :), allocatable :: rst
2678+ end function
2679+
2680+ module subroutine leg_set_layout (this , x )
2681+ class(legend), intent (inout ) :: this
2682+ character (len = * ), intent (in ) :: x
2683+ end subroutine
2684+
2685+ pure module function leg_get_opaque(this) result(rst)
2686+ class(legend), intent (in ) :: this
2687+ logical :: rst
2688+ end function
2689+
2690+ module subroutine leg_set_opaque (this , x )
2691+ class(legend), intent (inout ) :: this
2692+ logical :: x
2693+ end subroutine
26202694 end interface
26212695
26222696
0 commit comments