Skip to content

Layout

subsurfaceio.logplot.render.layout

Page geometry helpers and render constants.

Classes:

Name Description
PageLayout

Computed page geometry in pixels for one template.

Functions:

Name Description
compute_layout

Derive pixel layout from a LogPlotTemplate.

inches_to_px

Convert inches to pixels at PPI.

Attributes:

Name Type Description
FONT_FAMILY
FONT_PATH
FONT_SIZE
MAJOR_TICK_STEP
MINOR_TICK_STEP
PPI
PX_PER_PT
RECT_FILL
STROKE_WIDTH
TEXT_MARGIN_PX

FONT_FAMILY module-attribute

FONT_FAMILY = 'Arial, sans-serif'

FONT_PATH module-attribute

FONT_PATH = 'arial.ttf'

FONT_SIZE module-attribute

FONT_SIZE = 7

MAJOR_TICK_STEP module-attribute

MAJOR_TICK_STEP = 1.0

MINOR_TICK_STEP module-attribute

MINOR_TICK_STEP = 0.2

PPI module-attribute

PPI = 96

PX_PER_PT module-attribute

PX_PER_PT = 72 / PPI

RECT_FILL module-attribute

RECT_FILL = 'none'

STROKE_WIDTH module-attribute

STROKE_WIDTH = 0.6

TEXT_MARGIN_PX module-attribute

TEXT_MARGIN_PX = 7

PageLayout pydantic-model

Bases: BaseModel

Computed page geometry in pixels for one template.

Attributes:

Name Type Description
width float

Page width in pixels.

height float

Page height in pixels.

margin_left float

Left margin in pixels.

margin_right float

Right margin in pixels.

margin_bottom float

Bottom margin in pixels.

title_height float

Title band height in pixels.

header_height float

Metadata header height in pixels.

headers_height float

Column-title band height in pixels.

report_body_height float

Log body height in pixels.

Config:

  • frozen: True

Fields:

content_width property

content_width: float

Drawable width between left and right margins.

header_height pydantic-field

header_height: float

headers_height pydantic-field

headers_height: float

height pydantic-field

height: float

margin_bottom pydantic-field

margin_bottom: float

margin_left pydantic-field

margin_left: float

margin_right pydantic-field

margin_right: float

model_config class-attribute instance-attribute

model_config = ConfigDict(frozen=True)

report_body_height pydantic-field

report_body_height: float

title_height pydantic-field

title_height: float

width pydantic-field

width: float

compute_layout

compute_layout(template: LogPlotTemplate) -> PageLayout

Derive pixel layout from a LogPlotTemplate.

Parameters:

Name Type Description Default
template LogPlotTemplate

Figure size, margins, header, and column-header style.

required

Returns:

Type Description
PageLayout

Frozen page geometry used by page assembly and column renderers.

inches_to_px

inches_to_px(value: int | float) -> float

Convert inches to pixels at PPI.

Parameters:

Name Type Description Default
value int | float

Length in inches.

required

Returns:

Type Description
float

Length in pixels.