foresight_axis
foresight_axis, a plot axis: user settings and the derived effective range and ticks.
Range semantics follow gnuplot set xrange [min:max]: min is the value at the axis start and max at its end (min > max reverses the axis); an unset end is autoscaled to the data and extended outward to the tick grid.
Text labels from the data (using ...:xtic(1)), when any, replace the ticks, as gnuplot: a tick at each labelled value inside the range, the range itself not extended. They are derived per rendering (labels), never stored in the user settings tics, so a multiplot does not carry the categories of a panel into the next one.
Source: src/lib/foresight_axis.F90
Dependencies
Contents
Derived Types
axis_object
Plot axis.
Components
| Name | Type | Attributes | Description |
|---|---|---|---|
has_data | logical | Data placed on the axis, set by setup. | |
noextend | logical | Autoscaled ends not extended to the ticks, set by the user (gnuplot set autoscale noextend, fix). | |
data_lo | real(kind=R8P) | Smallest data value placed, set by setup. | |
data_hi | real(kind=R8P) | Largest data value placed, set by setup. | |
offset | real(kind=R8P) | Autoscaled ends moved out, start and end (gnuplot set offsets): in axis units, or graph fractions. | |
offset_graph | logical | offset in graph fractions of the autoscaled range. | |
label | character(len=:) | allocatable | Axis label, empty for none. |
log | logical | Base-10 logarithmic scale. | |
min_fixed | logical | Axis start set by the user, else autoscaled. | |
max_fixed | logical | Axis end set by the user, else autoscaled. | |
min_user | real(kind=R8P) | User value at the axis start. | |
max_user | real(kind=R8P) | User value at the axis end. | |
plot_min_fixed | logical | Axis start of the current plot, over the user one, gnuplot plot [min:max]. | |
plot_max_fixed | logical | Axis end of the current plot, over the user one. | |
plot_min | real(kind=R8P) | Value at the axis start of the current plot. | |
plot_max | real(kind=R8P) | Value at the axis end of the current plot. | |
lo | real(kind=R8P) | Effective value at the axis start, set by setup. | |
hi | real(kind=R8P) | Effective value at the axis end, set by setup. | |
tics | type(tics_object) | User tick settings: fixed step, none, label format. | |
time | logical | Time values (seconds since 1970): time ticks and labels, gnuplot set xdata time. | |
timefmt | character(len=:) | allocatable | Input time format, the day and month order of the invented labels (gnuplot set timefmt). |
tight | logical | Autoscaled ends not extended to the ticks (images, the color axis), as gnuplot. | |
ticks | type(tick_object) | allocatable | Ticks, set by setup. |
labels | type(tick_object) | allocatable | Text labels from the data, by value; none if unallocated or empty. |
reverse | logical | Reversed when an end is autoscaled (gnuplot set xrange reverse). | |
bounded | logical | Limits of the autoscaled ends given: (end, lower or upper), gnuplot set xrange [lb<*<ub:lb<*<ub]. | |
limits | real(kind=R8P) | Those limits. | |
map_u | real(kind=R8P) | allocatable | A nonlinear axis (gnuplot set nonlinear): unit positions, increasing, of the table; unallocated for a linear or log axis. |
map_x | real(kind=R8P) | allocatable | Its values at them, NaN where undefined (a broken axis). |
map_f | real(kind=R8P) | allocatable | Those values with each NaN filled by the last defined one (the search). |
map_sign | real(kind=R8P) | 1 if the values grow along the table, -1 if they fall. |
Type-Bound Procedures
| Name | Attributes | Description |
|---|---|---|
accepts | pass(self) | Whether a value can be placed on the axis. |
has_label | pass(self) | Whether the axis has a label. |
labelled | pass(self) | Whether text labels from the data replace the ticks. |
range_of | pass(self) | Range before the tick extension. |
set_range | pass(self) | Set the range, gnuplot style. |
setup | pass(self) | Compute effective range and ticks. |
to_unit | pass(self) | Map a value to the unit interval. |
Subroutines
set_range
Set the range as gnuplot set xrange [min:max]: an absent end is autoscaled.
Attributes: pure
subroutine set_range(self, min, max)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(axis_object) | inout | Axis. | |
min | real(kind=R8P) | in | optional | Value at the axis start. |
max | real(kind=R8P) | in | optional | Value at the axis end. |
Call graph
range_of
Values at the axis start and end from the data extent and the user ends, before the extension to the ticks: the range functions are sampled on, as gnuplot.
A degenerate range is widened by 1% (gnuplot "empty range" behaviour); with no data the range defaults to [-10:10], or [1:10] on a log axis.
Attributes: pure
subroutine range_of(self, dmin, dmax, has_data, lo, hi)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(axis_object) | in | Axis. | |
dmin | real(kind=R8P) | in | Smallest placeable data value. | |
dmax | real(kind=R8P) | in | Largest placeable data value. | |
has_data | logical | in | Whether dmin/dmax are meaningful. | |
lo | real(kind=R8P) | out | Value at the axis start. | |
hi | real(kind=R8P) | out | Value at the axis end. |
Call graph
setup
Compute the effective range (range_of) and the ticks from the data extent and the axis length.
subroutine setup(self, dmin, dmax, has_data, npx)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(axis_object) | inout | Axis. | |
dmin | real(kind=R8P) | in | Smallest placeable data value. | |
dmax | real(kind=R8P) | in | Largest placeable data value. | |
has_data | logical | in | Whether dmin/dmax are meaningful. | |
npx | real(kind=R8P) | in | Axis length [px]. |
Call graph
Functions
paxis_default
A parallel axis as set at first: autoscaled to its values without extension, no ticks. Built by components, not by a structure constructor: nvfortran 26.9 -O0 leaves the default-initialized array components (bounded) of a constructed axis undefined.
Attributes: pure
Returns: type(axis_object)
function paxis_default() result(axis)Call graph
accepts
Whether v can be placed on the axis: finite, and positive on a log axis.
Attributes: elemental
Returns: logical
function accepts(self, v) result(ok)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(axis_object) | in | Axis. | |
v | real(kind=R8P) | in | Value. |
Call graph
has_label
Whether the axis has a non-empty label.
Attributes: pure
Returns: logical
function has_label(self) result(has)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(axis_object) | in | Axis. |
Call graph
labelled
Whether text labels from the data replace the ticks: some are set and the ticks are not turned off.
Attributes: pure
Returns: logical
function labelled(self) result(yes)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(axis_object) | in | Axis. |
Call graph
to_unit
Map the placeable value v to the axis unit interval: 0 at the axis start, 1 at its end.
Attributes: elemental
Returns: real(kind=R8P)
function to_unit(self, v) result(u)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(axis_object) | in | Axis. | |
v | real(kind=R8P) | in | Value. |
Call graph
map_unit
The unit position of v on a nonlinear axis by its table (map_* of axis_object): linear between the two entries around v (the first such pair, so an entry right at the edge of an undefined part is found defined), NaN if one of them is undefined, extrapolated beyond the ends.
Attributes: pure
Returns: real(kind=R8P)
function map_unit(mu, mx, mf, sgn, v) result(u)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
mu | real(kind=R8P) | in | Unit positions. | |
mx | real(kind=R8P) | in | Values, NaN where undefined. | |
mf | real(kind=R8P) | in | Values, filled. | |
sgn | real(kind=R8P) | in | Direction of the values. | |
v | real(kind=R8P) | in | Value. |
Call graph