fortplot_layout Module

Layout and margin calculations for plotting backends

This module handles plot area geometry and margin calculations, following Single Responsibility Principle by focusing solely on layout-related functionality.

Author: fortplot contributors



Derived Types

type, public ::  plot_margins_t

Components

Type Visibility Attributes Name Initial
real(kind=wp), public :: left = 0.125_wp
real(kind=wp), public :: right = 0.9_wp
real(kind=wp), public :: bottom = 0.11_wp
real(kind=wp), public :: top = 0.88_wp

type, public ::  plot_area_t

Components

Type Visibility Attributes Name Initial
integer, public :: left
integer, public :: bottom
integer, public :: width
integer, public :: height

Functions

public pure function twiny_top_offset_px(dpi, has_top_xlabel) result(offset)

Extra image pixels to push the plot-area top edge down for a twiny (top x-axis), beyond the default top margin.

Read more…

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: dpi
logical, intent(in) :: has_top_xlabel

Return Value integer


Subroutines

public subroutine calculate_plot_area(canvas_width, canvas_height, margins, plot_area, top_offset_px)

Calculate plot area based on canvas size and margins (matplotlib-compatible) Note: left/bottom are margins, right/top are edge positions

Read more…

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: canvas_width
integer, intent(in) :: canvas_height
type(plot_margins_t), intent(in) :: margins
type(plot_area_t), intent(out) :: plot_area
integer, intent(in), optional :: top_offset_px