calculate_plot_area Subroutine

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

top_offset_px (optional) pushes the plot-area top edge downward by that many image pixels. A twiny (top x-axis) needs this so its tick labels, axis label, and the figure title fit above the axes without clipping. When absent or non-positive the geometry is unchanged, preserving the matplotlib-exact default edges.

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