dm_plot Module

Abstraction layer over Gnuplot.


Uses

  • module~~dm_plot~~UsesGraph module~dm_plot dm_plot iso_c_binding iso_c_binding module~dm_plot->iso_c_binding module~dm_dp dm_dp module~dm_plot->module~dm_dp module~dm_error dm_error module~dm_plot->module~dm_error module~dm_file dm_file module~dm_plot->module~dm_file module~dm_kind dm_kind module~dm_plot->module~dm_kind module~dm_pipe dm_pipe module~dm_plot->module~dm_pipe module~dm_string dm_string module~dm_plot->module~dm_string module~dm_time dm_time module~dm_plot->module~dm_time module~dm_dp->module~dm_error module~dm_dp->module~dm_kind module~dm_dp->module~dm_time module~dm_error->module~dm_kind module~dm_ascii dm_ascii module~dm_error->module~dm_ascii module~dm_file->module~dm_error module~dm_file->module~dm_kind iso_fortran_env iso_fortran_env module~dm_kind->iso_fortran_env module~dm_pipe->module~dm_error module~dm_pipe->module~dm_kind unix unix module~dm_pipe->unix module~dm_string->module~dm_error module~dm_string->module~dm_kind module~dm_time->module~dm_error module~dm_time->module~dm_kind module~dm_util dm_util module~dm_time->module~dm_util module~dm_util->module~dm_error module~dm_util->module~dm_kind

Used by

  • module~~dm_plot~~UsedByGraph module~dm_plot dm_plot module~dm_report dm_report module~dm_report->module~dm_plot module~dmpack dmpack module~dmpack->module~dm_plot module~dmpack->module~dm_report

Variables

Type Visibility Attributes Name Initial
integer, public, parameter :: PLOT_STYLE_NONE = 0

Invalid style.

integer, public, parameter :: PLOT_STYLE_LINES = 1

Lines.

integer, public, parameter :: PLOT_STYLE_LINESPOINTS = 2

Lines with symbols.

integer, public, parameter :: PLOT_STYLE_DOTS = 3

Dots.

integer, public, parameter :: PLOT_STYLE_POINTS = 4

Points.

integer, public, parameter :: PLOT_STYLE_LAST = 4

Never use this.

integer, public, parameter :: PLOT_TERMINAL_NONE = 0

Invalid terminal.

integer, public, parameter :: PLOT_TERMINAL_ANSI = 1

ASCII with ANSI colours (dumb).

integer, public, parameter :: PLOT_TERMINAL_ASCII = 2

ASCII (dumb).

integer, public, parameter :: PLOT_TERMINAL_GIF = 3

GIF (libgd).

integer, public, parameter :: PLOT_TERMINAL_PNG = 4

PNG (libgd).

integer, public, parameter :: PLOT_TERMINAL_PNG_CAIRO = 5

PNG (libcairo).

integer, public, parameter :: PLOT_TERMINAL_SIXEL = 6

Sixel (libgd).

integer, public, parameter :: PLOT_TERMINAL_SVG = 7

SVG.

integer, public, parameter :: PLOT_TERMINAL_X11 = 8

X11.

integer, public, parameter :: PLOT_TERMINAL_LAST = 8

Never use this.

integer, public, parameter :: PLOT_TERMINAL_NAME_LEN = 8

Max. terminal name length.

character(len=*), public, parameter :: PLOT_TIME_FORMAT = '%Y-%m-%dT%H:%M:%S'

Datetime format.

character(len=*), public, parameter :: PLOT_TERMINAL_NAMES(PLOT_TERMINAL_NONE:PLOT_TERMINAL_LAST) = [character(len=PLOT_TERMINAL_NAME_LEN)::'none', 'ansi', 'ascii', 'gif', 'png', 'pngcairo', 'sixelgd', 'svg', 'x11']

Gnuplot terminal names.


Derived Types

type, public ::  plot_type

Plot context type.

Components

Type Visibility Attributes Name Initial
integer, public :: terminal = PLOT_TERMINAL_NONE

Output terminal.

integer, public :: style = PLOT_STYLE_LINES

Plot line style.

integer, public :: width = 800

Plot width.

integer, public :: height = 300

Plot height.

character(len=FILE_PATH_LEN), public :: output = ' '

Output file name.

character(len=8), public :: background = ' '

Background colour (optional).

character(len=8), public :: foreground = '#3b4cc0'

Foreground colour (optional).

character(len=8), public :: graph = '#ffffff'

Graph background colour.

character(len=FILE_PATH_LEN), public :: font = ' '

Font name or file path (optional).

character(len=128), public :: title = ' '

Plot title (optional).

character(len=128), public :: xlabel = ' '

X label (optional).

character(len=128), public :: ylabel = ' '

Y label (optional).

character(len=TIME_LEN), public :: xrange(2) = ' '

X axis range.

real(kind=r8), public :: yrange(2) = 0.0_r8

Y axis range.

logical, public :: bidirect = .false.

Bi-directional anonymous pipe.

logical, public :: persist = .false.

Persistent Gnuplot process (use only with X11).

logical, public :: xautoscale = .true.

Auto-scale X axis.

logical, public :: yautoscale = .true.

Auto-scale Y axis.

logical, public :: grid = .true.

Show grid.

logical, public :: legend = .false.

Show legend.


Functions

public function dm_plot_error(plot, bytes) result(n)

Returns Gnuplot's standard error output in allocatable character string bytes. The result is allocated but empty if no output to standard error has been made.

Arguments

Type IntentOptional Attributes Name
type(plot_type), intent(inout) :: plot

Plot settings.

character(len=:), intent(out), allocatable :: bytes

Bytes returned by Gnuplot.

Return Value integer(kind=i8)

public function dm_plot_lines(plot, dps) result(rc)

Plots XY data points as line chart.

Arguments

Type IntentOptional Attributes Name
type(plot_type), intent(inout) :: plot

Plot settings.

type(dp_type), intent(inout) :: dps(:)

Data points array.

Return Value integer

public function dm_plot_read(plot, bytes) result(n)

Returns number of bytes read from Gnuplot, and plot data in bytes.

Arguments

Type IntentOptional Attributes Name
type(plot_type), intent(inout) :: plot

Plot settings.

character(len=:), intent(out), allocatable :: bytes

Bytes returned by Gnuplot.

Return Value integer(kind=i8)

public pure elemental function dm_plot_terminal_from_name(name) result(terminal)

Returns Gnuplot terminal backend of given name.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: name

Return Value integer

public pure elemental function dm_plot_terminal_is_valid(terminal) result(valid)

Returns .true. if the given terminal is valid. PLOT_TERMINAL_NONE is an invalid terminal.

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: terminal

Terminal type enumerator.

Return Value logical

public function dm_plot_version(name, found) result(version)

Returns Gnuplot version as allocatable string. This function is quite slow as Gnuplot has to be started in a new process.

Arguments

Type IntentOptional Attributes Name
logical, intent(in), optional :: name

Add prefix gnuplot/.

logical, intent(out), optional :: found

Returns .true. if Gnuplot has been found.

Return Value character(len=:), allocatable