fortplot_label_positioning Module

Separate positioning for tick labels vs axis labels Follows matplotlib exact spacing measurements



Variables

Type Visibility Attributes Name Initial
integer, public, parameter :: LABEL_SPACING_X = 20
integer, public, parameter :: LABEL_SPACING_Y = 15

Subroutines

public subroutine calculate_x_label_position(tick_x, plot_bottom, plot_height, label_text, label_x, label_y)

Calculate X-axis label position with matplotlib-style centering and spacing

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: tick_x
real(kind=wp), intent(in) :: plot_bottom
real(kind=wp), intent(in) :: plot_height
character(len=*), intent(in) :: label_text
real(kind=wp), intent(out) :: label_x
real(kind=wp), intent(out) :: label_y

public subroutine calculate_y_label_position(tick_y, plot_left, label_text, label_x, label_y)

Calculate Y-axis label position with right alignment and proper spacing

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: tick_y
real(kind=wp), intent(in) :: plot_left
character(len=*), intent(in) :: label_text
real(kind=wp), intent(out) :: label_x
real(kind=wp), intent(out) :: label_y

public subroutine calculate_x_tick_label_position(tick_x, plot_bottom, label_text, label_x, label_y)

Calculate X-axis tick label position using proper font metrics and matplotlib spacing

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: tick_x
real(kind=wp), intent(in) :: plot_bottom
character(len=*), intent(in) :: label_text
real(kind=wp), intent(out) :: label_x
real(kind=wp), intent(out) :: label_y

public subroutine calculate_y_tick_label_position(tick_y, plot_left, label_text, label_x, label_y)

Calculate Y-axis tick label position using proper font metrics

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: tick_y
real(kind=wp), intent(in) :: plot_left
character(len=*), intent(in) :: label_text
real(kind=wp), intent(out) :: label_x
real(kind=wp), intent(out) :: label_y

public subroutine calculate_x_axis_label_position(center_x, plot_bottom, label_text, label_x, label_y)

Calculate X-axis label position (40px below plot)

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: center_x
real(kind=wp), intent(in) :: plot_bottom
character(len=*), intent(in) :: label_text
real(kind=wp), intent(out) :: label_x
real(kind=wp), intent(out) :: label_y

public subroutine calculate_y_axis_label_position(center_y, plot_left, label_text, label_x, label_y)

Calculate Y-axis label position with proper spacing from tick labels

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: center_y
real(kind=wp), intent(in) :: plot_left
character(len=*), intent(in) :: label_text
real(kind=wp), intent(out) :: label_x
real(kind=wp), intent(out) :: label_y

public subroutine calculate_x_tick_label_position_pdf(tick_x, plot_bottom, label_text, label_x, label_y)

Calculate X-axis tick label position for PDF (Y=0 at bottom, increases upward)

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: tick_x
real(kind=wp), intent(in) :: plot_bottom
character(len=*), intent(in) :: label_text
real(kind=wp), intent(out) :: label_x
real(kind=wp), intent(out) :: label_y

public subroutine calculate_y_tick_label_position_pdf(tick_y, plot_left, label_text, label_x, label_y)

Calculate Y-axis tick label position for PDF (Y=0 at bottom, increases upward)

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: tick_y
real(kind=wp), intent(in) :: plot_left
character(len=*), intent(in) :: label_text
real(kind=wp), intent(out) :: label_x
real(kind=wp), intent(out) :: label_y