fortplot_tick_formatting Module

Tick value formatting functions with multiple strategies

Provides: - Range-aware tick formatting - Smart formatting with character limits - Logarithmic tick value formatting - String utility functions for tick labels



Functions

public function format_tick_value(value, range) result(formatted)

Format tick value based on data range like matplotlib

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: value
real(kind=wp), intent(in) :: range

Return Value character(len=20)

public function format_tick_value_smart(value, max_chars) result(formatted)

Smart tick value formatting with automatic exponential notation for long labels Limits output to max_chars and uses exponential notation when needed

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: value
integer, intent(in) :: max_chars

Return Value character(len=20)

public function format_log_tick_value(value) result(formatted)

Format logarithmic tick values using scientific notation like matplotlib

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: value

Return Value character(len=20)

public function format_power_of_ten_label(value) result(formatted)

Build a mathtext-friendly power-of-ten label: 10^{n} or -10^{n}

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: value

Return Value character(len=20)


Subroutines

public subroutine remove_trailing_zeros(str)

Remove trailing zeros from decimal representation

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(inout) :: str

public subroutine ensure_leading_zero(str)

Ensure numbers like .5 become 0.5 for readability

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(inout) :: str