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 |
|---|---|---|---|
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. | |
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. | |
tight | logical | Autoscaled ends not extended to the ticks (images, | |
ticks | type(tick_object) | allocatable | Ticks, set by setup. |
labels | type(tick_object) | allocatable | Text labels from the data, by value; none if unallocated |
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
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