Skip to content

foresight_backend ​

foresight_backend, abstract output device.

Two coordinate spaces. Page primitives take pixel coordinates (origin top-left, y downward). The data_* primitives, valid between begin_plot_area and end_plot_area, take unit-square coordinates of the plot area (origin bottom-left, y upward, [0, 1] spanning the axis ranges) and are clipped to it. Keeping data in unit coordinates lets an interactive device zoom and pan by changing a single view transform.

A panel is bracketed by begin_axes/end_axes, which hand the device the panel geometry and axis ranges, and its redrawable decorations (grid, ticks) by named begin_group/end_group: an interactive device regenerates them after a zoom, a static one just writes them.

Source: src/lib/foresight_backend.F90

Dependencies

Contents ​

Variables ​

NameTypeAttributesDescription
HEAD_LENGTHreal(kind=R8P)parameterLongest default arrowhead barb [px], gnuplot svg (2 tics).
HEAD_ANGLEreal(kind=R8P)parameterArrowhead barb angle off the shaft [deg], gnuplot default.

Derived Types ​

axes_view ​

Geometry and axis ranges of a plot panel.

Components

NameTypeAttributesDescription
areareal(kind=R8P)Plot area: left, right, top, bottom [px].
xreal(kind=R8P)x axis values at the axis start and end.
yreal(kind=R8P)y axis values at the axis start and end.
xloglogicalLog x axis.
yloglogicalLog y axis.
gridlogicalGrid shown.
markuplogicalTick labels with enhanced text markup, drawn again by the viewer as such.
font_sizereal(kind=R8P)Font size [px].
xticscharacter(len=:)allocatablex tick positions for the viewer (tics_object%attribute), empty for auto.
yticscharacter(len=:)allocatabley tick positions for the viewer, empty for auto.
xformatcharacter(len=:)allocatablex tick label format, empty for the default.
yformatcharacter(len=:)allocatabley tick label format, empty for the default.
mirrorlogicalTicks mirrored on the opposite border: x, y, y2.
y2_activelogicalSecond y axis drawn; the y2* components are meaningful only then.
y2real(kind=R8P)y2 axis values at the axis start and end.
y2loglogicalLog y2 axis.
y2ticscharacter(len=:)allocatabley2 tick positions for the viewer, empty for auto.
y2formatcharacter(len=:)allocatabley2 tick label format, empty for the default.
x2_activelogicalSecond x axis drawn; the x2* components are meaningful only then.
x2real(kind=R8P)x2 axis values at the axis start and end.
x2loglogicalLog x2 axis.
x2mirrorlogicalx2 ticks mirrored on the bottom border.
x2ticscharacter(len=:)allocatablex2 tick positions for the viewer, empty for auto.
x2formatcharacter(len=:)allocatablex2 tick label format, empty for the default.
xtimecharacter(len=:)allocatableInput time format of a time x axis (its timefmt), empty if numeric.
ytimecharacter(len=:)allocatableInput time format of a time y axis, empty if numeric.
y2timecharacter(len=:)allocatableInput time format of a time y2 axis, empty if numeric.
x2timecharacter(len=:)allocatableInput time format of a time x2 axis, empty if numeric.
gridlinescharacter(len=:)allocatableGrid lines (x y2 mx), empty for the x and y major ones.
gridstylecharacter(len=:)allocatableGrid line color width dashes, empty for the theme's.
three_dlogicalA 3D view: static on an interactive device (no zoom, no pan).

backend_object ​

Abstract output device.

Inheritance

Attributes: abstract

Components

NameTypeAttributesDescription
themetype(theme_object)Output theme: colors the layout's ones are mapped to (foresight_theme).
enhancedlogicalTexts read as gnuplot's enhanced text (foresight_enhanced).
latin1logicalTexts in ISO 8859-1, written in UTF-8 (set encoding iso_8859_1).
literallogicalThe texts written now as they are (an automatic title, noenhanced).
texlogicalTexts are LaTeX source, set by LaTeX (cairolatex): numbers in math mode.
text_sizereal(kind=R8P)Default font size of the texts [px].
boxedlogicalThe texts written now are boxed (gnuplot's textbox): on the background.
page_familycharacter(len=48)Font family of the page (set terminal ... font), empty: the device's.
fonttype(font_object)The font of the texts written now (gnuplot font "..."); unset parts the page's.
head_pxreal(kind=R8P)Length [px] and angle [deg] of the data arrowheads drawn now, 0 for the default head.
head_fixedlogicalThose heads keep their size on short arrows (gnuplot fixed).

Type-Bound Procedures

NameAttributesDescription
begin_pagepass(self)Open the output page.
end_pagepass(self)Close the output page.
begin_axespass(self)Open a plot panel.
end_axespass(self)Close the plot panel.
begin_grouppass(self)Open a named group.
end_grouppass(self)Close the group.
rectpass(self)Rectangle [px].
polylinepass(self)Polyline [px].
dotspass(self)Round dots or markers [px].
polygonpass(self)Filled polygon [px].
imagepass(self)Raster image [px].
textpass(self)Text [px].
begin_plot_areapass(self)Open the clipped plot area.
end_plot_areapass(self)Close the plot area.
data_polylinepass(self)Polyline [unit square].
data_dotspass(self)Dots or markers [unit square].
data_barspass(self)Error bars [unit square].
data_polygonpass(self)Filled polygon [unit square].
data_imagepass(self)Raster image [unit square].
text_widthpass(self)Text width [px].
readoutpass(self)Seven-segment readout [px].
readout_extentpass(self)Readout size [px].
data_arrowspass(self)Arrows [unit square].
data_labelpass(self)Text at a point [unit square].
rotates_textpass(self)Whether text can be rotated.
wants_scenepass(self)Whether 3D scenes are written.
scenepass(self)A 3D view's scene (JSON).
row_heightpass(self)Text row height, 0 if none.
hoverpass(self)Text on mouse-over of a point.
pixmappass(self)A PNG image [px].
front_areapass(self)Open or close the front layer of the plot area.

Subroutines ​

scene ​

The scene of a 3D view (foresight_scene3d's JSON), in the open panel: nothing on a device without a viewer.

fortran
subroutine scene(self, json)

Arguments

NameTypeIntentAttributesDescription
selfclass(backend_object)inoutDevice.
jsoncharacter(len=*)inScene.

Call graph

hover ​

text shown on mouse-over of the point (x, y) [unit square], a disk of diameter [px] (gnuplot's hypertext): nothing on a device without a mouse.

fortran
subroutine hover(self, x, y, text, diameter)

Arguments

NameTypeIntentAttributesDescription
selfclass(backend_object)inoutDevice.
xreal(kind=R8P)inAbscissa [unit].
yreal(kind=R8P)inOrdinate [unit].
textcharacter(len=*)inText.
diameterreal(kind=R8P)inSensitive disk [px].

pixmap ​

The PNG image png (base64) with its top left corner at (x, y), width x height [px], stretched (gnuplot set pixmap): nothing on a device without images.

fortran
subroutine pixmap(self, x, y, width, height, png)

Arguments

NameTypeIntentAttributesDescription
selfclass(backend_object)inoutDevice.
xreal(kind=R8P)inLeft side [px].
yreal(kind=R8P)inTop side [px].
widthreal(kind=R8P)inWidth [px].
heightreal(kind=R8P)inHeight [px].
pngcharacter(len=*)inThe PNG file, base64.

Call graph

front_area ​

Open (opening) or close the front layer of the plot area, after its overlays (markers, caps): the data space objects of gnuplot's front layer go above the points. separate false on a device that draws them in the plot area (before it closes): this one, nothing to open or close.

fortran
subroutine front_area(self, opening, separate)

Arguments

NameTypeIntentAttributesDescription
selfclass(backend_object)inoutDevice.
openinglogicalinOpen, else close.
separatelogicaloutA layer of its own.

Call graph

arrow_head ​

The barbs of gnuplot's default arrowhead at tip pointing away from tail [px, any orientation], HEAD_ANGLE degrees off the shaft, barbs(:, 1) and barbs(:, 2): gnuplot's do_arrow (term.c) scales the head with the shaft, 0.3 of its length L, within 0.3 and 2 average tic lengths (HEAD_LENGTH is the longest), so heads shrink on arrows shorter than about 60 px and stop shrinking at 2.7 px. A zero length shaft has no head (both barbs at the tip), as gnuplot's.

Attributes: pure

fortran
subroutine arrow_head(tail, tip, barbs)

Arguments

NameTypeIntentAttributesDescription
tailreal(kind=R8P)inTail [px].
tipreal(kind=R8P)inTip [px].
barbsreal(kind=R8P)outBarb ends [px].

Call graph

sized_head ​

The barbs of an arrowhead at tip pointing away from tail [px, any orientation], length px long, angle degrees off the shaft: barbs(:, 1) and barbs(:, 2). A zero length shaft has no head (both barbs at the tip), as gnuplot's do_arrow. On a shaft shorter than twice the barbs the head shrinks to half the shaft, its angle widened so the barbs spread as far (gnuplot's effective_length), unless fixed.

Attributes: pure

fortran
subroutine sized_head(tail, tip, length, angle, barbs, fixed)

Arguments

NameTypeIntentAttributesDescription
tailreal(kind=R8P)inTail [px].
tipreal(kind=R8P)inTip [px].
lengthreal(kind=R8P)inBarb length [px].
anglereal(kind=R8P)inBarb angle [deg].
barbsreal(kind=R8P)outBarb ends [px].
fixedlogicalinoptionalThe head keeps its size (gnuplot fixed).

Call graph

Functions ​

rotates_text ​

Whether the device draws text rotated, as tick labels rotated by gnuplot: true but on text devices, which write them horizontally, as gnuplot's dumb terminal.

Attributes: pure

Returns: logical

fortran
function rotates_text(self) result(rotates)

Arguments

NameTypeIntentAttributesDescription
selfclass(backend_object)inDevice.

Call graph

wants_scene ​

Whether the device writes the scene of a 3D view (the HTML page, for the viewer's mouse rotation): no.

Attributes: pure

Returns: logical

fortran
function wants_scene(self) result(wants)

Arguments

NameTypeIntentAttributesDescription
selfclass(backend_object)inDevice.

Call graph

row_height ​

Height of a text row of the device [px]: 0 on vector devices, where text sits anywhere.

Attributes: pure

Returns: real(kind=R8P)

fortran
function row_height(self) result(height)

Arguments

NameTypeIntentAttributesDescription
selfclass(backend_object)inDevice.

Call graph

default_head_length ​

Barb length of gnuplot's default arrowhead on a shaft shaft px long (term.c do_arrow): HEAD_COEFF (0.3) of the shaft, at least HEAD_SHORT_LIMIT (0.3) and at most HEAD_LONG_LIMIT (2) average tic lengths, the tic HEAD_LENGTH/2 (9 px, gnuplot's svg).

Attributes: elemental

Returns: real(kind=R8P)

fortran
function default_head_length(shaft) result(length)

Arguments

NameTypeIntentAttributesDescription
shaftreal(kind=R8P)inShaft length [px].

Call graph

Released under the GPL v3, BSD 2-Clause, BSD 3-Clause or MIT License.