fortplot_subplot_layout Module



Subroutines

public subroutine compute_tight_subplot_margins(backend, subplots_array, nr, nc, xscale, yscale, symlog_threshold, left_f, right_f, bottom_f, top_f, ok, suptitle_height_frac)

Compute per-cell subplot margins in fractional figure coordinates. Margins, inter-column gaps, and inter-row gaps are driven by each panel's decoration sizes (tick labels, axis labels, titles) so every panel's y-axis label sits to the left of its plot box and the top row's x-axis label clears the title of the row below. Short figures additionally reclaim excess margin so the panels fill at least MIN_AXES_FILL_FRAC of the figure height, matching matplotlib's default vertical fill.

Arguments

Type IntentOptional Attributes Name
class(*), intent(in) :: backend
type(subplot_data_t), intent(in) :: subplots_array(:,:)
integer, intent(in) :: nr
integer, intent(in) :: nc
character(len=*), intent(in) :: xscale
character(len=*), intent(in) :: yscale
real(kind=wp), intent(in) :: symlog_threshold
real(kind=wp), intent(out), allocatable :: left_f(:,:)
real(kind=wp), intent(out), allocatable :: right_f(:,:)
real(kind=wp), intent(out), allocatable :: bottom_f(:,:)
real(kind=wp), intent(out), allocatable :: top_f(:,:)
logical, intent(out) :: ok
real(kind=wp), intent(in), optional :: suptitle_height_frac