foresight_ticks
foresight_ticks, axis tick placement and labelling.
Automatic steps are gnuplot's (quantize_normal_tics, guide 20): they depend on the axis range only, not on its length in pixels (probed on gnuplot 6.0 from 150 to 1200 px: [-2:2] steps by 0.5, [0:1] by 0.2, [0:13] by 2). The range normalised to its decade, f in [1, 10), gives the step 0.2 (f < 2), 0.5 (f < 5) or 1 times the decade. Log axes place majors at integer decades, every 1, 2, 5, 10, ... decades by the same rule on the decade count. Tick values are carried as the integer pair (n, e) meaning n * 10**e, so labels are exact decimal strings, free of floating point noise such as 0.30000000000000004.
User settings (tics_object, gnuplot set xtics and set format) replace the automatic rule: a fixed step from an optional start to an optional end (a multiplying factor on log axes), no ticks at all, or a printf-like label format. Fixed steps are kept as the decimal text the user wrote, so linear ticks stay exact decimals too.
An explicit list (gnuplot set xtics ("label" pos level, ...)) replaces those ticks, or is added to them (add): its items inside the range, a label printed as written (a format when it has a conversion, "%.1f"), the axis label of the position when absent; level 1 is a minor tick. A list alone does not extend the range to a tick grid.
Minor ticks (gnuplot set mxtics [N]) divide each interval between consecutive major ticks of the automatic or fixed ticks in N parts, linearly in value also on log axes, within the range and the fixed ticks' start and end; without N (gnuplot's automatic count) in 2 when the step's leading digit is 2, else 5, and in 9 on log axes. By default linear axes have none, log axes 9 intervals between majors (the 2..9 multiples of a decade on one-decade steps), as gnuplot; unset mxtics removes them.
Time axes (gnuplot set xdata time) follow gnuplot's time rules (quantize_time_tics): the step in whole seconds, minutes, hours, days, weeks, months or years, the ticks justified to whole units (time_tic_just), labels written by strftime with the format set or one gnuplot invents from the range (%H:%M, %m/%d\n%H:%M, ...).
The same rules are mirrored by the interactive viewer, which must regenerate identical ticks after a zoom.
Source: src/lib/foresight_ticks.F90
Dependencies
Contents
- tick_object
- tic_item
- tics_object
- push
- enable
- set_auto
- clear_list
- disable
- set_list
- set_fixed
- nice_step
- gnuplot_step
- time_ticks
- quantize_time_tics
- sort_ticks
- linear_ticks
- log_ticks
- append_minors
- common_scale
- fixed_values
- list_ticks
- merge_list
- fixed_linear_ticks
- fixed_log_ticks
- tick_label
- format_label
- push_tick
- push_item
- attribute
- labels_attribute
- anchor
- has_list
- has_format
- time_tick_format
- looks_numeric
- duodecimal
- time_level
- auto_time_minitics
- decimal_value
- minor_count
- power
- label_format
- grid_value
- is_scientific
Variables
| Name | Type | Attributes | Description |
|---|---|---|---|
TICS_AUTO | integer(kind=I4P) | parameter | Ticks by the automatic rule. |
TICS_FIXED | integer(kind=I4P) | parameter | Ticks at a fixed step. |
TICS_NONE | integer(kind=I4P) | parameter | No ticks. |
MINOR_DEFAULT | integer(kind=I4P) | parameter | Minor ticks by default: none on linear axes, 2..9 on log ones. |
MINOR_AUTO | integer(kind=I4P) | parameter | gnuplot's automatic count, set mxtics. |
MINOR_NONE | integer(kind=I4P) | parameter | No minor ticks, unset mxtics; N > 1: N intervals. |
TOL | real(kind=R8P) | parameter | Tolerance on tick-grid membership, in units of the step. |
SCI_HIGH | real(kind=R8P) | parameter | Labels switch to scientific notation from this magnitude... |
SCI_LOW | real(kind=R8P) | parameter | ...or below this one. |
MAX_TICKS | integer(kind=I8P) | parameter | Tick count cap: no ticks beyond it (degenerate or extreme zoom). |
MAX_POWER | integer(kind=I8P) | parameter | Largest power of a fixed log step: no ticks beyond it. |
Derived Types
tick_object
Axis tick.
Components
| Name | Type | Attributes | Description |
|---|---|---|---|
value | real(kind=R8P) | Data value. | |
major | logical | Major (labelled) tick, else minor. | |
label | character(len=:) | allocatable | Label text, empty for minor ticks. |
sup | character(len=:) | allocatable | Superscript appended to the label, empty if none. |
tic_item
Item of an explicit tick list, gnuplot ("label" pos level).
Components
| Name | Type | Attributes | Description |
|---|---|---|---|
value | real(kind=R8P) | Position. | |
major | logical | Level 0 (labelled), else level 1: a minor tick. | |
labelled | logical | The label is given, else the axis label of the position. | |
label | character(len=:) | allocatable | Label as written, a format if it has a conversion. |
tics_object
User tick settings of an axis, gnuplot set xtics and set format.
Components
| Name | Type | Attributes | Description |
|---|---|---|---|
mode | integer(kind=I4P) | TICS_AUTO, TICS_FIXED or TICS_NONE. | |
additive | logical | A fixed step added on a log axis too (gnuplot nologscale), not a factor. | |
plain | logical | The labels as they are, not enhanced text (noenhanced). | |
offset | real(kind=R8P) | Label shift [characters, x right, y up], gnuplot offset. | |
color | character(len=24) | Label color, the frame's if blank (gnuplot textcolor). | |
font | type(font_object) | Label font (gnuplot font "..."), the page's if unset. | |
on_axis | logical | On the zero axis of the other coordinate, gnuplot axis. | |
rangelimited | logical | Ticks and border side within the data range. | |
start | character(len=:) | allocatable | Fixed ticks start (decimal text), empty for none. |
step | character(len=:) | allocatable | Fixed ticks step, a factor on log axes (decimal text). |
end | character(len=:) | allocatable | Fixed ticks end (decimal text), empty for none. |
format | character(len=:) | allocatable | Label format, empty for the default labels. |
mirror | logical | Ticks also on the opposite border, gnuplot mirror. | |
series | logical | The automatic or fixed ticks, else the explicit list alone. | |
minor | integer(kind=I4P) | Minor ticks: MINOR_DEFAULT, MINOR_AUTO, MINOR_NONE or N. | |
minor_count | integer(kind=I4P) | Minor ticks of a time axis every minor_count minor_unit (gnuplot set mxtics time N UNITS), 0 none. | |
minor_unit | character(len=7) | seconds, minutes, hours, days, weeks, months, years. | |
rotate | real(kind=R8P) | Label angle [deg, counterclockwise], gnuplot rotate by. | |
justify | character(len=6) | Label justification of rotated labels: left, right, center, or blank for gnuplot's (right for rotate). | |
out | logical | Ticks outward, gnuplot out. | |
scale | real(kind=R8P) | Major and minor tick lengths, in major lengths (gnuplot scale MAJOR,MINOR; 0 draws no tick). | |
list | type(tic_item) | allocatable | Explicit list, gnuplot set xtics ("label" pos level, ...). |
per_label | logical | gnuplot's default % h labels, each by %g (with a x10 superscript exponent), of the scripts; else the library's per-axis rule (SCI_HIGH, SCI_LOW). | |
geographic | logical | Labels in degrees, minutes, seconds by the format (gnuplot set xtics geographic, %D %M %S %E %N). |
Type-Bound Procedures
| Name | Attributes | Description |
|---|---|---|
attribute | pass(self) | Viewer attribute of the tick positions. |
clear_list | pass(self) | Forget the explicit list, back to the automatic or fixed ticks. |
disable | pass(self) | No ticks, the explicit list forgotten, gnuplot unset xtics. |
enable | pass(self) | Turn the ticks on, keeping their positions. |
has_format | pass(self) | Whether a label format is set. |
has_list | pass(self) | Whether an explicit list is set. |
anchor | pass(self) | Text anchor of the rotated labels. |
set_auto | pass(self) | Automatic ticks, forgetting a fixed step. |
set_fixed | pass(self) | Set fixed ticks, validated. |
set_list | pass(self) | Set or extend the explicit list. |
Interfaces
push
Append an item through a temporary: nvfortran 26.9 corrupts list = [list, item] (and any list = f(list)) when the items hold deferred-length characters.
Module procedures: push_tick, push_item
Subroutines
enable
Turn off ticks on again at their last positions, as gnuplot set xtics without positions: the fixed step if one was set (and not reset by set_auto), else automatic. Ticks already on are unchanged.
Attributes: pure
subroutine enable(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(tics_object) | inout | Settings. |
Call graph
set_auto
Automatic ticks, as gnuplot set xtics auto: the fixed step is forgotten, so enable restores automatic ones.
Attributes: pure
subroutine set_auto(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(tics_object) | inout | Settings. |
Call graph
clear_list
Forget the explicit list: the automatic or fixed ticks again, as gnuplot set xtics with positions but no add.
Attributes: pure
subroutine clear_list(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(tics_object) | inout | Settings. |
Call graph
disable
No ticks, as gnuplot unset xtics: the explicit list is forgotten, a fixed step kept for enable.
Attributes: pure
subroutine disable(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(tics_object) | inout | Settings. |
Call graph
set_list
The explicit list items replaces the ticks, or with add extends the list and keeps the ticks, as gnuplot set xtics [add] ("label" pos level, ...); ticks turned off are turned on.
Attributes: pure
subroutine set_list(self, items, add)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(tics_object) | inout | Settings. | |
items | type(tic_item) | in | Items. | |
add | logical | in | Added to the ticks and the list. |
Call graph
set_fixed
Fixed ticks every step (a factor on log axes) from start to end, given as decimal texts (empty for absent); message is empty on success, else the settings are unchanged.
Attributes: pure
subroutine set_fixed(self, step, start, end, message)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(tics_object) | inout | Settings. | |
step | character(len=*) | in | Step. | |
start | character(len=*) | in | Start, empty for none. | |
end | character(len=*) | in | End, empty for none. | |
message | character(len=:) | out | allocatable | Problem, empty if none. |
Call graph
nice_step
Round raw > 0 to the "nice" step m * 10**e with m in {1, 2, 5}.
Attributes: pure
subroutine nice_step(raw, m, e)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
raw | real(kind=R8P) | in | Raw step. | |
m | integer(kind=I8P) | out | Step mantissa. | |
e | integer(kind=I4P) | out | Step exponent. |
gnuplot_step
gnuplot's automatic step m * 10**e of an axis range (> 0) long: quantize_normal_tics(range, 20), with the range normalised to its decade (f in [1, 10)): 2 10**(p-1) for f < 2, 5 10**(p-1) for f < 5, else 10**p. Exact powers of ten, so the viewer's mirror finds the same step.
Attributes: pure
subroutine gnuplot_step(range, m, e)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
range | real(kind=R8P) | in | Axis range. | |
m | integer(kind=I8P) | out | Step mantissa. | |
e | integer(kind=I4P) | out | Step exponent. |
Call graph
time_ticks
Ticks of a time axis (values in seconds since 1970), as gnuplot's: the automatic step quantize_time_tics (or the fixed step of tics, in seconds), autoscaled ends extended outward to it and justified to whole time units, the ticks justified so too, labelled with the time format of tics or one invented from the range (time_tick_format, timefmt giving the day and month order). Minor ticks: set mxtics N divides each step in N, set mxtics gnuplot's automatic time step, none by default; set mxtics time N UNITS one at every N units of time (seconds to weeks: multiples of N units since the epoch; months and years: the first day of every N-th month or year, counted from 1970), as gnuplot 6.0.
Attributes: pure
subroutine time_ticks(lo, hi, extend_lo, extend_hi, ticks, tics, timefmt)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
lo | real(kind=R8P) | inout | Value at the axis start (lo > hi: reversed). | |
hi | real(kind=R8P) | inout | Value at the axis end. | |
extend_lo | logical | in | Extend lo outward to the tick grid. | |
extend_hi | logical | in | Extend hi outward to the tick grid. | |
ticks | type(tick_object) | out | allocatable | Ticks, ascending in value. |
tics | type(tics_object) | in | User settings. | |
timefmt | character(len=*) | in | Input time format (gnuplot set timefmt). |
Call graph
quantize_time_tics
gnuplot's quantize_time_tics: the step tic rounded to whole seconds, minutes, hours, days, weeks, months or years for a range xr [s], and its level (0 seconds ... 6 years).
Attributes: pure
subroutine quantize_time_tics(tic, xr, level)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
tic | real(kind=R8P) | inout | Step [s]. | |
xr | real(kind=R8P) | in | Range [s]. | |
level | integer(kind=I4P) | out | Time level. |
Call graph
sort_ticks
Sort the ticks by value (insertion sort: few ticks, the majors and minors interleaved).
Attributes: pure
subroutine sort_ticks(ticks)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
ticks | type(tick_object) | inout | Ticks. |
Call graph
linear_ticks
Major ticks of a linear axis (npx pixels long, kept for the interface: gnuplot's density does not depend on it); autoscaled ends are extended outward to the tick grid.
With tics: no ticks and no extension (TICS_NONE), or the fixed grid (TICS_FIXED), and the label format.
Attributes: pure
subroutine linear_ticks(lo, hi, npx, extend_lo, extend_hi, ticks, tics)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
lo | real(kind=R8P) | inout | Value at the axis start (lo > hi: reversed). | |
hi | real(kind=R8P) | inout | Value at the axis end. | |
npx | real(kind=R8P) | in | Axis length [px]. | |
extend_lo | logical | in | Extend lo outward to the tick grid. | |
extend_hi | logical | in | Extend hi outward to the tick grid. | |
ticks | type(tick_object) | out | allocatable | Ticks, ascending in value. |
tics | type(tics_object) | in | optional | User settings. |
Call graph
log_ticks
Ticks of a base-10 log axis npx pixels long; autoscaled ends are extended outward to whole decades.
Majors sit at decades (labelled 10 with the exponent as superscript), minors at 2..9 times a decade when the axis spans at most 10 decades. With fewer than two decades in range the minors are labelled too, in plain decimals; if still fewer than two ticks are labelled (a range inside one decade), linear ticks are placed instead.
With tics: no ticks (TICS_NONE), or ticks multiplying by the step (TICS_FIXED), and the label format; the extension to decades applies anyway, as in gnuplot.
Attributes: pure
subroutine log_ticks(lo, hi, npx, extend_lo, extend_hi, ticks, tics)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
lo | real(kind=R8P) | inout | Value at the axis start, > 0. | |
hi | real(kind=R8P) | inout | Value at the axis end, > 0. | |
npx | real(kind=R8P) | in | Axis length [px]. | |
extend_lo | logical | in | Extend lo outward to a decade. | |
extend_hi | logical | in | Extend hi outward to a decade. | |
ticks | type(tick_object) | out | allocatable | Ticks, majors first. |
tics | type(tics_object) | in | optional | User settings. |
Call graph
append_minors
Append to ticks the minor ticks of the majors first + k step (first step**k on a log axis), n intervals between consecutive majors, linear in value, inside [lo, hi] (either order) and [lower, upper]; none for n < 2.
Attributes: pure
subroutine append_minors(ticks, first, step, logaxis, n, lo, hi, lower, upper)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
ticks | type(tick_object) | inout | allocatable | Ticks. |
first | real(kind=R8P) | in | A major tick. | |
step | real(kind=R8P) | in | Major step, a factor (> 1) on a log axis. | |
logaxis | logical | in | Log axis. | |
n | integer(kind=I4P) | in | Intervals between majors. | |
lo | real(kind=R8P) | in | Value at the axis start. | |
hi | real(kind=R8P) | in | Value at the axis end. | |
lower | real(kind=R8P) | in | Smallest value of the series. | |
upper | real(kind=R8P) | in | Largest value of the series. |
Call graph
common_scale
Rescale the decimals n * 10**e to their smallest exponent, keeping every mantissa below 1e15 (exact in the viewer's double precision integers); ok false if impossible.
Attributes: pure
subroutine common_scale(n, e, ok)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
n | integer(kind=I8P) | inout | Mantissas. | |
e | integer(kind=I4P) | inout | Exponents, all equal on exit. | |
ok | logical | out | Rescaled. |
Call graph
fixed_values
Decimals of the fixed ticks at a common exponent: n holds step, start (0 if none) and end mantissas.
Attributes: pure
subroutine fixed_values(tics, n, e, has_start, has_end)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
tics | type(tics_object) | in | Settings, TICS_FIXED (validated by set_fixed). | |
n | integer(kind=I8P) | out | Mantissas: step, start, end. | |
e | integer(kind=I4P) | out | Exponents, equal. | |
has_start | logical | out | Start given. | |
has_end | logical | out | End given. |
Call graph
list_ticks
The items of the explicit list of tics inside [lo, hi] (either order), or all of them if everywhere, in the list order: a label as written, by itself as the format if it is one ("%.1f", gnuplot), the axis label of the position (set format, else the default one for the range) if absent; minor items have none.
Attributes: pure
subroutine list_ticks(tics, lo, hi, everywhere, ticks)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
tics | type(tics_object) | in | Settings. | |
lo | real(kind=R8P) | in | Value at the axis start. | |
hi | real(kind=R8P) | in | Value at the axis end. | |
everywhere | logical | in | All the items, whatever the range. | |
ticks | type(tick_object) | out | allocatable | Ticks. |
Call graph
merge_list
Add to ticks the items of the explicit list of tics inside [lo, hi], each replacing a tick at its position (gnuplot set xtics add): the remaining ticks keep their order, the items follow.
Attributes: pure
subroutine merge_list(tics, lo, hi, ticks)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
tics | type(tics_object) | in | Settings. | |
lo | real(kind=R8P) | in | Value at the axis start. | |
hi | real(kind=R8P) | in | Value at the axis end. | |
ticks | type(tick_object) | inout | allocatable | Ticks. |
Call graph
fixed_linear_ticks
Ticks at start + k * step within [start, end], as gnuplot set xtics START,STEP,END.
An autoscaled end is extended outward to a multiple of the step, unless it lies outside [start, end] (gnuplot).
Attributes: pure
subroutine fixed_linear_ticks(lo, hi, extend_lo, extend_hi, tics, ticks)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
lo | real(kind=R8P) | inout | Value at the axis start. | |
hi | real(kind=R8P) | inout | Value at the axis end. | |
extend_lo | logical | in | lo autoscaled. | |
extend_hi | logical | in | hi autoscaled. | |
tics | type(tics_object) | in | Settings, TICS_FIXED. | |
ticks | type(tick_object) | out | allocatable | Ticks, ascending in value. |
Call graph
fixed_log_ticks
Ticks of a log axis at start * step**k (start 1 if absent) within [start, end], as gnuplot set ytics on a log axis: the step is a factor, greater than 1.
Tick values are built by repeated multiplication, so that the viewer reproduces them exactly.
Attributes: pure
subroutine fixed_log_ticks(lo, hi, tics, ticks)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
lo | real(kind=R8P) | in | Value at the axis start, > 0. | |
hi | real(kind=R8P) | in | Value at the axis end, > 0. | |
tics | type(tics_object) | in | Settings, TICS_FIXED. | |
ticks | type(tick_object) | out | allocatable | Ticks, ascending in value. |
Call graph
tick_label
Label of the tick value n * 10**e: by the user format of tics if any, else by format_label; gnuplot's default (per_label) over the axis span: %.Pf when the ends have one sign and P = ceil(-log10(min(|hi - lo|, |lo|))) is 5 to 9 (gnuplot's copy_or_invent_formatstring), else %h per label.
Attributes: pure
subroutine tick_label(n, e, sci, label, sup, tics, span)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
n | integer(kind=I8P) | in | Value mantissa. | |
e | integer(kind=I4P) | in | Value exponent. | |
sci | logical | in | Scientific notation (default labels). | |
label | character(len=:) | out | allocatable | Label text. |
sup | character(len=:) | out | allocatable | Label superscript. |
tics | type(tics_object) | in | optional | User settings. |
span | real(kind=R8P) | in | optional | Axis start and end. |
Call graph
format_label
Label of the tick value n * 10**e: plain decimal, or gnuplot-like 1.5x10 with the exponent as superscript.
Attributes: pure
subroutine format_label(n, e, sci, label, sup)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
n | integer(kind=I8P) | in | Value mantissa. | |
e | integer(kind=I4P) | in | Value exponent. | |
sci | logical | in | Scientific notation. | |
label | character(len=:) | out | allocatable | Label text. |
sup | character(len=:) | out | allocatable | Label superscript. |
Call graph
push_tick
Append item to list (an unallocated list is empty), through a temporary: see push.
Attributes: pure
subroutine push_tick(list, item)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
list | type(tick_object) | inout | allocatable | List. |
item | type(tick_object) | in | New item. |
push_item
Append item to list (an unallocated list is empty), through a temporary: see push.
Attributes: pure
subroutine push_item(list, item)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
list | type(tic_item) | inout | allocatable | List. |
item | type(tic_item) | in | New item. |
Functions
attribute
Tick positions for the viewer: empty for automatic, none, or START STEP END with * for an absent end, then minor auto|N unless minor ticks are by default (auto first if automatic), out for outward ticks, rotate ANGLE ANCHOR for rotated labels and scale MAJOR MINOR for tick lengths not the default. With an explicit list (and the axis range [lo, hi], for the default labels of its items): labels and its items (see labels_attribute), after auto or the step when the list is added to them.
Attributes: pure
Returns: character(len=:)
function attribute(self, lo, hi) result(text)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(tics_object) | in | Settings. | |
lo | real(kind=R8P) | in | optional | Value at the axis start. |
hi | real(kind=R8P) | in | optional | Value at the axis end. |
Call graph
labels_attribute
Text labels for the viewer: labels then value:label pairs, blank separated, each label percent-encoded (every byte but letters, digits and -._~), so blanks and colons in a label never split it; a superscript follows as ^sup, a minor tick is value!.
Attributes: pure
Returns: character(len=:)
function labels_attribute(labels) result(text)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
labels | type(tick_object) | in | Labelled values. |
Call graph
anchor
Text anchor of the rotated labels, as gnuplot: by their justification, else start (gnuplot rotate by).
Attributes: pure
Returns: character(len=6)
function anchor(self) result(text_anchor)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(tics_object) | in | Settings. |
Call graph
has_list
Whether an explicit list is set.
Attributes: pure
Returns: logical
function has_list(self) result(has)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(tics_object) | in | Settings. |
Call graph
has_format
Whether a label format is set.
Attributes: pure
Returns: logical
function has_format(self) result(has)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(tics_object) | in | Settings. |
Call graph
time_tick_format
Label format of a time axis: format if it is a time format (not a numeric printf one), else gnuplot's invented one (copy_or_invent_formatstring): within one day %H:%M (:%S for steps under a minute, %M alone at the day level); over days %m/%d (%d/%m when timefmt has the day first, then /%y or /%Y across years) and \n%H:%M below the week level.
Attributes: pure
Returns: character(len=:)
function time_tick_format(format, level, lo, hi, timefmt) result(chosen)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
format | character(len=*) | in | Format set, empty for none. | |
level | integer(kind=I4P) | in | Time level of the step. | |
lo | real(kind=R8P) | in | Axis start. | |
hi | real(kind=R8P) | in | Axis end. | |
timefmt | character(len=*) | in | Input time format. |
Call graph
looks_numeric
gnuplot's looks_like_numeric: the first conversion is a numeric printf one (%5.2f, %g, %e, ...).
Attributes: pure
Returns: logical
function looks_numeric(format) result(numeric)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
format | character(len=*) | in | Format. |
Call graph
duodecimal
gnuplot's quantize_duodecimal_tics: a step for arg in a duodecimal reference (12 or 60 based).
Attributes: pure
Returns: real(kind=R8P)
function duodecimal(arg, guide) result(tic)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
arg | real(kind=R8P) | in | Range in the unit. | |
guide | integer(kind=I4P) | in | Approximate number of ticks. |
Call graph
time_level
Time level of a fixed step [s], as gnuplot's setup_tics.
Attributes: pure
Returns: integer(kind=I4P)
function time_level(step) result(level)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
step | real(kind=R8P) | in | Step [s]. |
Call graph
auto_time_minitics
gnuplot's make_auto_time_minitics: the minor step [s] of a time step incr at level, 0 for none.
Attributes: pure
Returns: real(kind=R8P)
function auto_time_minitics(level, incr) result(tinc)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
level | integer(kind=I4P) | in | Time level. | |
incr | real(kind=R8P) | in | Major step [s]. |
Call graph
decimal_value
Value of a decimal text (a fixed tick start, step or end).
Attributes: pure
Returns: real(kind=R8P)
function decimal_value(text) result(v)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
text | character(len=*) | in | Decimal text. |
Call graph
minor_count
Intervals between major ticks for the minor ticks of tics: 0 with none, N if set, by default 9 on a log axis and 0 on a linear one, else gnuplot's automatic count: 9 on a log axis, 2 when the leading digit of the step mantissa is 2, else 5.
Attributes: pure
Returns: integer(kind=I4P)
function minor_count(tics, mantissa, logaxis) result(n)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
tics | type(tics_object) | in | Settings. | |
mantissa | integer(kind=I8P) | in | Step mantissa (any trailing zeros). | |
logaxis | logical | in | Log axis. |
Call graph
power
first * factor**k by |k| multiplications or divisions: the operation sequence the viewer repeats.
Attributes: pure
Returns: real(kind=R8P)
function power(first, factor, k) result(v)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
first | real(kind=R8P) | in | Start. | |
factor | real(kind=R8P) | in | Factor. | |
k | integer(kind=I8P) | in | Power. |
label_format
The label format of tics: the user's, else gnuplot's default (per_label) over the axis span: %.Pf when the ends have one sign and P = ceil(-log10(min(|hi - lo|, |lo|))) is 5 to 9 (gnuplot's copy_or_invent_formatstring), else %h, %g per label.
Attributes: pure
Returns: character(len=:)
function label_format(tics, span) result(format)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
tics | type(tics_object) | in | Settings. | |
span | real(kind=R8P) | in | Axis start and end. |
Call graph
grid_value
Value n * 10**e, correctly rounded for |e| <= 22 (powers of ten are exact there); beyond, scaled in steps of 1e22, the operation sequence the viewer repeats.
Attributes: pure
Returns: real(kind=R8P)
function grid_value(n, e) result(value)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
n | integer(kind=I8P) | in | Mantissa. | |
e | integer(kind=I4P) | in | Exponent. |
Call graph
is_scientific
Whether labels of an axis reaching magnitude use scientific notation.
Attributes: pure
Returns: logical
function is_scientific(magnitude) result(sci)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
magnitude | real(kind=R8P) | in | Largest absolute value on the axis. |
Call graph