foresight_annotations
foresight_annotations, labels, arrows and objects placed on a panel (gnuplot
set label,set arrow,set object).
A position is two coordinates, each in its system: first (the x or y axis values), second (the x2 or y2 ones), graph (fractions of the plot area from its bottom left), screen (fractions of the page) or character (character cells from the page's bottom left: 0.6 of the font size wide, the font size high, as the label offsets), as gnuplot.
Labels and arrows are not clipped, as gnuplot's; objects are clipped by the plot area when both coordinates of every point are axis values (gnuplot's default clip), drawn in data space then (the interactive viewer zooms them with the data); else on the page. Layers: back (the default) behind the data, front over the frame, behind (objects) behind the grid too.
Source: src/lib/foresight_annotations.F90
Dependencies
Contents
- place_object
- label_object
- arrow_object
- shape_object
- pixmap_object
- frame_object
- push
- draw_labels
- draw_arrows
- draw_pixmaps
- draw_shapes
- push_label
- push_arrow
- push_pixmap
- push_shape
- in_data
- anchored
- unit_of
- label_shift
- page_of
- span_of
- in_space
- has_shapes
- color_of
- dashes_of
- anchor_of
Variables
| Name | Type | Attributes | Description |
|---|---|---|---|
FRAME_COLOR | character(len=*) | parameter | Default text and line color (the theme maps it). |
PI | real(kind=R8P) | parameter | pi. |
Derived Types
place_object
A position: its coordinates and the system of each.
Components
| Name | Type | Attributes | Description |
|---|---|---|---|
x | real(kind=R8P) | Abscissa. | |
y | real(kind=R8P) | Ordinate. | |
sx | character(len=9) | System of the abscissa: first, second, graph, screen, character. | |
sy | character(len=9) | System of the ordinate. | |
z | real(kind=R8P) | Height (gnuplot's third coordinate, the 3D views'). | |
sz | character(len=9) | System of the height: first (z axis values), graph, screen. |
label_object
A label, gnuplot set label.
Components
| Name | Type | Attributes | Description |
|---|---|---|---|
tag | integer(kind=I4P) | Tag (set label N). | |
plain | logical | The text as it is, not enhanced text (noenhanced). | |
text | character(len=:) | allocatable | Text. |
at | type(place_object) | Position. | |
justify | character(len=6) | left, center or right of the position. | |
rotate | real(kind=R8P) | Angle [deg, counterclockwise]. | |
color | character(len=:) | allocatable | Text color, the frame's if empty. |
front | logical | Over the frame, else behind the data. | |
point | logical | A point marks the position. | |
pt | integer(kind=I4P) | Point type. | |
ps | real(kind=R8P) | Point size. | |
font | type(font_object) | Font (set label font "..."). | |
offset | real(kind=R8P) | Text offset [y upward], in offset_system. | |
offset_system | character(len=9) | Systems of the offset: character, first, second, graph, screen (gnuplot's position). | |
boxed | logical | On the background (gnuplot boxed, a drawn text box style). | |
palette | integer(kind=I4P) | Palette color: 1 of its z (tc palette z), 2 of a color axis value (cb V), 3 of a fraction (frac F); 0 none. | |
palette_value | real(kind=R8P) | The value V or the fraction F. |
arrow_object
An arrow, gnuplot set arrow.
Components
| Name | Type | Attributes | Description |
|---|---|---|---|
tag | integer(kind=I4P) | Tag (set arrow N). | |
from | type(place_object) | Tail. | |
to | type(place_object) | Tip, or the tip from the tail (rto). | |
relative | logical | rto: to is relative to from. | |
head | integer(kind=I4P) | Heads: 0 none, 1 at the tip, 2 at the tail, 3 both. | |
length | real(kind=R8P) | Head length (0: the default head). | |
length_system | character(len=9) | System of the head length (x direction). | |
angle | real(kind=R8P) | Head barb angle [deg]. | |
fixed | logical | The head keeps its size on a short arrow (fixed). | |
fill | character(len=8) | Heads nofilled (two barbs), filled, empty, noborder. | |
front | logical | Over the frame, else behind the data. | |
polar | logical | The tip by a length and an angle from the tail (gnuplot length L angle A), not by to. | |
span | real(kind=R8P) | That length, negative backwards. | |
span_system | character(len=9) | Its system (along x: first, second, graph, screen, character). | |
direction | real(kind=R8P) | That angle on the page [deg, counterclockwise from x]. | |
color | character(len=:) | allocatable | Line color, the frame's if empty. |
lw | real(kind=R8P) | Line width [px]. | |
dashes | character(len=:) | allocatable | SVG dash array, empty for solid. |
shape_object
An object, gnuplot set object: a rectangle, circle, ellipse or polygon.
Components
| Name | Type | Attributes | Description |
|---|---|---|---|
tag | integer(kind=I4P) | Tag (set object N). | |
kind | character(len=9) | rectangle, circle, ellipse, polygon. | |
points | type(place_object) | allocatable | Rectangle corners (2) or centre (1, with size); circle and ellipse centre; polygon vertices. |
size | type(place_object) | Rectangle and ellipse width and height, circle radius (x, in the system sx). | |
sized | logical | The rectangle is given by its centre and size. | |
angle | real(kind=R8P) | Ellipse orientation [deg]. | |
arc | real(kind=R8P) | Circle arc [deg]. | |
style | type(style_object) | Fill, border, color, line width. | |
layer | character(len=6) | behind, back, front, depth (gnuplot's depthorder: a 3D polygon sorted with the pm3d quadrangles), fb (a wall). | |
clip | logical | Clipped by the plot area (axis coordinates only). | |
back_color | character(len=:) | allocatable | fc ls N of a depthorder polygon: the color of its back (line style N+1, gnuplot's 2-sided coloring). |
pixmap_object
An image from a PNG file, gnuplot set pixmap.
Components
| Name | Type | Attributes | Description |
|---|---|---|---|
tag | integer(kind=I4P) | Tag (set pixmap N). | |
png | character(len=:) | allocatable | The file, base64. |
wide_png | character(len=:) | allocatable | A colormap's entries as a row (colormap NAME), base64: drawn when more than twice as wide as high (gnuplot's). |
pixels | integer(kind=I4P) | Its width and height [pixels]. | |
at | type(place_object) | Position: the lower left corner, or the centre. | |
span | type(place_object) | Width and height, each in its system. | |
sized | integer(kind=I4P) | 0 its pixels, 1 size (both), 2 width (the height by the aspect), 3 height (the width by the aspect). | |
center | logical | at is the centre. | |
layer | character(len=6) | behind, back or front (gnuplot's default). |
frame_object
What a position needs: the plot area, the page, the axes.
Components
| Name | Type | Attributes | Description |
|---|---|---|---|
area | real(kind=R8P) | Plot area: left, right, top, bottom [px]. | |
canvas | real(kind=R8P) | Page width and height [px]. | |
cell | real(kind=R8P) | Character cell width and height [px]. |
Interfaces
push
Append an item through a temporary: nvfortran 26.9 corrupts list = [list, item] when the items hold deferred-length characters.
Module procedures: push_label, push_arrow, push_shape, push_pixmap
Subroutines
draw_labels
The labels of the layer (front or not): text at the position, justified, rotated, moved by the offset; a point marking the position if so set. Those tied to the data in the fs-anchored group (the viewer hides it while zoomed), the others in fs-annotations. Line start. Line end. Line counter.
subroutine draw_labels(labels, front, backend, area, canvas, font_size, xaxis, yaxis, x2axis, y2axis)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
labels | type(label_object) | in | Labels. | |
front | logical | in | The front layer, else the back one. | |
backend | class(backend_object) | inout | Output device. | |
area | real(kind=R8P) | in | Plot area: left, right, top, bottom [px]. | |
canvas | real(kind=R8P) | in | Page width and height [px]. | |
font_size | real(kind=R8P) | in | Font size [px]. | |
xaxis | type(axis_object) | in | x axis. | |
yaxis | type(axis_object) | in | y axis. | |
x2axis | type(axis_object) | in | x2 axis. | |
y2axis | type(axis_object) | in | y2 axis. |
Call graph
draw_arrows
The arrows of the layer (front or not): a shaft from the tail to the tip, heads as set (nofilled two barbs, filled, empty, noborder a triangle). Those tied to the data in the fs-anchored group.
subroutine draw_arrows(arrows, front, backend, area, canvas, font_size, xaxis, yaxis, x2axis, y2axis)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
arrows | type(arrow_object) | in | Arrows. | |
front | logical | in | The front layer, else the back one. | |
backend | class(backend_object) | inout | Output device. | |
area | real(kind=R8P) | in | Plot area: left, right, top, bottom [px]. | |
canvas | real(kind=R8P) | in | Page width and height [px]. | |
font_size | real(kind=R8P) | in | Font size [px]. | |
xaxis | type(axis_object) | in | x axis. | |
yaxis | type(axis_object) | in | y axis. | |
x2axis | type(axis_object) | in | x2 axis. | |
y2axis | type(axis_object) | in | y2 axis. |
Call graph
draw_pixmaps
The pixmaps of layer (behind, back, front), gnuplot set pixmap: each PNG at its position (its lower left corner, or its centre), its own pixels large, or size W,H, or width W (or height H) the other side by its aspect; W and H in their systems (first and second measured from the position, graph, screen fractions, character cells). Those tied to the data in the fs-anchored group (hidden by the viewer while zoomed).
subroutine draw_pixmaps(pixmaps, layer, backend, area, canvas, font_size, xaxis, yaxis, x2axis, y2axis)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
pixmaps | type(pixmap_object) | in | Pixmaps. | |
layer | character(len=*) | in | Layer. | |
backend | class(backend_object) | inout | Output device. | |
area | real(kind=R8P) | in | Plot area: left, right, top, bottom [px]. | |
canvas | real(kind=R8P) | in | Page width and height [px]. | |
font_size | real(kind=R8P) | in | Font size [px]. | |
xaxis | type(axis_object) | in | x axis. | |
yaxis | type(axis_object) | in | y axis. | |
x2axis | type(axis_object) | in | x2 axis. | |
y2axis | type(axis_object) | in | y2 axis. |
Call graph
draw_shapes
The objects of layer (behind, back, front), those in data space (data_space: clipped, both coordinates axis values, drawn in the unit square) or the others (on the page): rectangles, circles (an arc and its centre for a partial one), ellipses, polygons, in their fill and border.
subroutine draw_shapes(shapes, layer, data_space, backend, area, canvas, font_size, xaxis, yaxis, x2axis, y2axis)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
shapes | type(shape_object) | in | Objects. | |
layer | character(len=*) | in | Layer. | |
data_space | logical | in | The data space ones, else the page ones. | |
backend | class(backend_object) | inout | Output device. | |
area | real(kind=R8P) | in | Plot area: left, right, top, bottom [px]. | |
canvas | real(kind=R8P) | in | Page width and height [px]. | |
font_size | real(kind=R8P) | in | Font size [px]. | |
xaxis | type(axis_object) | in | x axis. | |
yaxis | type(axis_object) | in | y axis. | |
x2axis | type(axis_object) | in | x2 axis. | |
y2axis | type(axis_object) | in | y2 axis. |
Call graph
push_label
Append item to list through a temporary.
Attributes: pure
subroutine push_label(list, item)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
list | type(label_object) | inout | allocatable | List. |
item | type(label_object) | in | New item. |
push_arrow
Append item to list through a temporary.
Attributes: pure
subroutine push_arrow(list, item)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
list | type(arrow_object) | inout | allocatable | List. |
item | type(arrow_object) | in | New item. |
push_pixmap
Append item to list.
Attributes: pure
subroutine push_pixmap(list, item)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
list | type(pixmap_object) | inout | allocatable | List. |
item | type(pixmap_object) | in | Item. |
push_shape
Append item to list through a temporary.
Attributes: pure
subroutine push_shape(list, item)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
list | type(shape_object) | inout | allocatable | List. |
item | type(shape_object) | in | New item. |
Functions
in_data
Whether both coordinates of p are axis values (first, second).
Attributes: pure
Returns: logical
function in_data(p) result(yes)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
p | type(place_object) | in | Position. |
Call graph
anchored
Whether a coordinate of p is an axis value: the label or arrow moves with the data.
Attributes: pure
Returns: logical
function anchored(p) result(yes)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
p | type(place_object) | in | Position. |
Call graph
unit_of
p in the unit square of the plot area (x right, y up); NaN for a value its log axis cannot place.
Attributes: pure
Returns: real(kind=R8P)
function unit_of(p, xaxis, yaxis, x2axis, y2axis) result(u)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
p | type(place_object) | in | Position. | |
xaxis | type(axis_object) | in | x axis. | |
yaxis | type(axis_object) | in | y axis. | |
x2axis | type(axis_object) | in | x2 axis. | |
y2axis | type(axis_object) | in | y2 axis. |
Call graph
label_shift
The offset of label on the page [px, y downward], gnuplot's get_offsets (map_position_r): each coordinate in its system, character (the cell, gnuplot's svg 0.7 by 1.5 of the font size), graph (the plot area), screen (the page less a terminal unit), first and second (the axis' scale: the distance from its 0); the non-character ones truncated to gnuplot's svg units (1/100 px, an int cast).
Attributes: pure
Returns: real(kind=R8P)
function label_shift(label, frame, xaxis, yaxis, x2axis, y2axis) result(d)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
label | type(label_object) | in | Label. | |
frame | type(frame_object) | in | Plot area and page. | |
xaxis | type(axis_object) | in | x axis. | |
yaxis | type(axis_object) | in | y axis. | |
x2axis | type(axis_object) | in | x2 axis. | |
y2axis | type(axis_object) | in | y2 axis. |
Call graph
page_of
p on the page [px, y downward]; huge for an unplaceable value.
Attributes: pure
Returns: real(kind=R8P)
function page_of(p, frame, xaxis, yaxis, x2axis, y2axis) result(xy)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
p | type(place_object) | in | Position. | |
frame | type(frame_object) | in | Plot area and page. | |
xaxis | type(axis_object) | in | x axis. | |
yaxis | type(axis_object) | in | y axis. | |
x2axis | type(axis_object) | in | x2 axis. | |
y2axis | type(axis_object) | in | y2 axis. |
Call graph
span_of
The page size [px] of a width and height span (its systems in sx, sy) about centre: axis values measured across the centre (a log axis included), graph and screen ones as fractions, character ones in cells.
Attributes: pure
Returns: real(kind=R8P)
function span_of(centre, span, frame, xaxis, yaxis, x2axis, y2axis) result(size_px)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
centre | type(place_object) | in | Centre. | |
span | type(place_object) | in | Width and height. | |
frame | type(frame_object) | in | Plot area and page. | |
xaxis | type(axis_object) | in | x axis. | |
yaxis | type(axis_object) | in | y axis. | |
x2axis | type(axis_object) | in | x2 axis. | |
y2axis | type(axis_object) | in | y2 axis. |
Call graph
in_space
Whether shape is drawn in data space: clipped, every point (and the size) in axis values.
Attributes: pure
Returns: logical
function in_space(shape) result(yes)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
shape | type(shape_object) | in | Object. |
Call graph
has_shapes
Whether any of shapes is of layer and in data space (data_space), or on the page.
Attributes: pure
Returns: logical
function has_shapes(shapes, layer, data_space) result(yes)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
shapes | type(shape_object) | in | Objects. | |
layer | character(len=*) | in | Layer. | |
data_space | logical | in | The data space ones, else the page ones. |
Call graph
color_of
color, the frame's if unallocated or empty.
Attributes: pure
Returns: character(len=:)
function color_of(color) result(c)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
color | character(len=:) | in | allocatable | Color. |
Call graph
dashes_of
SVG dash array of arrow, empty for solid.
Attributes: pure
Returns: character(len=:)
function dashes_of(arrow) result(d)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
arrow | type(arrow_object) | in | Arrow. |
Call graph
anchor_of
SVG text anchor of a justification.
Attributes: pure
Returns: character(len=:)
function anchor_of(justify) result(anchor)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
justify | character(len=*) | in | left, center, right. |
Call graph