Core tick calculation algorithms for linear scales
Provides: - Nice tick location algorithms following matplotlib MaxNLocator - Axis limit calculation with nice boundaries - Linear scale tick generation
Determine decimal places based on step size for nice formatting
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(in) | :: | step |
Determine decimal places from an array of tick positions. Uses the smallest non-zero spacing as representative step.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(in) | :: | tick_positions(:) | |||
| integer, | intent(in) | :: | n |
Format tick value with consistent decimal places for uniform appearance
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(in) | :: | value | |||
| integer, | intent(in) | :: | decimal_places |
Calculate appropriate tick labels at nice locations like matplotlib Ensures all labels have consistent formatting and nice round numbers
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(in) | :: | data_min | |||
| real(kind=wp), | intent(in) | :: | data_max | |||
| integer, | intent(in) | :: | num_ticks | |||
| character(len=20), | intent(out) | :: | labels(:) |
Calculate nice axis limits that encompass the data like matplotlib The axis limits are set to nice round numbers based on tick locations
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(in) | :: | data_min | |||
| real(kind=wp), | intent(in) | :: | data_max | |||
| integer, | intent(in) | :: | target_num_ticks | |||
| real(kind=wp), | intent(out) | :: | nice_min | |||
| real(kind=wp), | intent(out) | :: | nice_max |
Find nice tick locations following matplotlib's MaxNLocator algorithm exactly
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(in) | :: | data_min | |||
| real(kind=wp), | intent(in) | :: | data_max | |||
| integer, | intent(in) | :: | target_num_ticks | |||
| real(kind=wp), | intent(out) | :: | nice_min | |||
| real(kind=wp), | intent(out) | :: | nice_max | |||
| real(kind=wp), | intent(out) | :: | nice_step | |||
| real(kind=wp), | intent(out) | :: | tick_locations(:) | |||
| integer, | intent(out) | :: | actual_num_ticks |
Calculate minor tick positions between major ticks Places minor_count minor ticks between each pair of major ticks
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(in) | :: | major_ticks(:) | |||
| integer, | intent(in) | :: | num_major | |||
| integer, | intent(in) | :: | minor_count | |||
| real(kind=wp), | intent(in) | :: | data_min | |||
| real(kind=wp), | intent(in) | :: | data_max | |||
| real(kind=wp), | intent(out) | :: | minor_ticks(:) | |||
| integer, | intent(out) | :: | num_minor |
Calculate minor tick positions for log scale at 2,3,4,5,6,7,8,9 within decades
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(in) | :: | major_ticks(:) | |||
| integer, | intent(in) | :: | num_major | |||
| real(kind=wp), | intent(in) | :: | data_min | |||
| real(kind=wp), | intent(in) | :: | data_max | |||
| real(kind=wp), | intent(out) | :: | minor_ticks(:) | |||
| integer, | intent(out) | :: | num_minor |