Simply Fortran Return to Top

Reference

The following page outlines the application programming interface for the Aplot library.

Constants

The following constants are used by the library:

Plot Type

APLOT_STYLE_LINE Plot series as continuous line
APLOT_STYLE_DOT Plot series as a 5-pixel square dot
APLOT_STYLE_PIXEL Plot series as a single pixel per point
APLOT_STYLE_BAR Plot series as a bar chart

Plot Management

initialize_plot

Fortran function initialize_plot ()

Description

Initializes a new plot.

Return Value

Fortran type(aplot_t)

A derived type that internally represents the plot itself

destroy_plot

Fortran subroutine destroy_plot (p)

Description

Destroys an existing plot, freeing any memory associated with it.

Arguments

Argument Fortran Type Description
p type(aplot_t) An existing plot variable

display_plot

Fortran subroutine display_plot (p)

Description

Displays a plot and blocks program execution until the user closes the window. The plot must be configured entirely prior to calling this routine.

Calling this routine twice for the same plot argument is not supported. Users should create a new plot variable entirely attempting to call this routine twice or more on the plot vairable.

Arguments

Argument Fortran Type Description
p type(aplot_t) An existing plot variable

set_title

Fortran subroutine set_title (p, nm)

Description

Sets the title displayed above the plot.

Arguments

Argument Fortran Type Description
p type(aplot_t) An existing plot variable
nm character(*) The label to apply to the plot

Plot Data

add_dataset

Fortran subroutine add_dataset (p, x, y)

Description

Adds a dataset to an existing plot variable.

Arguments

Argument Fortran Type Description
p type(aplot_t) An existing plot variable
x real, dimension(:) A one-dimensional array of x-axis points
y real, dimension(:) A one-dimensional array of y-axis points corresponding to each point in x

set_serieslabel

Fortran subroutine set_serieslabel (p, i, nm)

Description

Assigns a label to the ith series. The series are zero-indexed (i.e. the first series added to the plot is i=0).

Arguments

Argument Fortran Type Description
p type(aplot_t) An existing plot variable
i integer The zero-indexed series to label
nm character(*) The label to apply to the series

set_seriestype

Fortran subroutine set_seriestype (p, i, tp)

Description

Configures the type of plot for a given series using the constants APLOT_STYLE_LINE, APLOT_STYLE_DOT, APLOT_STYLE_PIXEL, and APLOT_STYLE_BAR. The series are zero-indexed (i.e. the first series added to the plot is i=0).

Arguments

Argument Fortran Type Description
p type(aplot_t) An existing plot variable
i integer The zero-indexed series to label
tp integer The desired series type

Axis Configuration

set_xautoscale

Fortran subroutine set_xautoscale (p)

Description

Enable autoscaling of the x-axis (the default configuration).

Arguments

Argument Fortran Type Description
p type(aplot_t) An existing plot variable

set_yautoscale

Fortran subroutine set_yautoscale (p)

Description

Enable autoscaling of the y-axis (the default configuration).

Arguments

Argument Fortran Type Description
p type(aplot_t) An existing plot variable

set_xlabel

Fortran subroutine set_xlabel (p, nm)

Description

Set the desired label for the x-axis.

Arguments

Argument Fortran Type Description
p type(aplot_t) An existing plot variable
nm character(*) The label to apply to the x-axis

set_ylabel

Fortran subroutine set_ylabel (p, nm)

Description

Set the desired label for the y-axis.

Arguments

Argument Fortran Type Description
p type(aplot_t) An existing plot variable
nm character(*) The label to apply to the y-axis

set_xlinear

Fortran subroutine set_xlinear (p)

Description

Configures the x axis to a linear scale (default)

Arguments

Argument Fortran Type Description
p type(aplot_t) An existing plot variable

set_xlogarithmic

Fortran subroutine set_xlogarithmic (p, base)

Description

Configures the x axis to a logarithmic scale with an optional base specified. If not present, the base is assumed to be 10.0.

Arguments

Argument Fortran Type Description
p type(aplot_t) An existing plot variable
base real Optional: base for logarithmic scale

set_ylinear

Fortran subroutine set_ylinear (p)

Description

Configures the y axis to a linear scale (default)

Arguments

Argument Fortran Type Description
p type(aplot_t) An existing plot variable

set_ylogarithmic

Fortran subroutine set_ylogarithmic (p, base)

Description

Configures the y axis to a logarithmic scale with an optional base specified. If not present, the base is assumed to be 10.0.

Arguments

Argument Fortran Type Description
p type(aplot_t) An existing plot variable
base real Optional: base for logarithmic scale

set_xscale

Fortran subroutine set_xscale (p, vmin, vmax)

Description

Manually sets the scaling for the x-axis

Arguments

Argument Fortran Type Description
p type(aplot_t) An existing plot variable
vmin real The minimum value represented on the x-axis
vmax real The maximum value represented on the x-axis

set_yscale

Fortran subroutine set_yscale (p, vmin, vmax)

Description

Manually sets the scaling for the y-axis

Arguments

Argument Fortran Type Description
p type(aplot_t) An existing plot variable
vmin real The minimum value represented on the y-axis
vmax real The maximum value represented on the y-axis