Skip to main content

compute_layout

Function compute_layout 

Source
pub fn compute_layout(config: &LayoutConfig) -> LayoutResult
Expand description

Computes the layout for a single axes within a figure.

The algorithm works inward from the figure edges in the following order:

  1. Outer padding on all four sides.
  2. Top: title (if present), then a gap.
  3. Bottom: x-axis label (if present), then x-axis tick labels, then a gap.
  4. Left: y-axis label (if present), then y-axis tick labels, then a gap.
  5. Right: legend (if present), then a gap.

Whatever remains in the center becomes the plot_area. If the remaining space is smaller than the configured minimums the plot area is clamped so that content is never collapsed to zero.