fortplot_matplotlib_axes Module

Axes, scale, and labelling helpers for the matplotlib facade



Interfaces

public interface axis

Set aspect ratio: axis('equal'), axis('auto'), or axis(2.0)

  • private subroutine axis_str(aspect)

    Set axis aspect ratio using string mode: 'equal' or 'auto'

    Arguments

    Type IntentOptional Attributes Name
    character(len=*), intent(in) :: aspect
  • private subroutine axis_num(ratio)

    Set axis aspect ratio using a numeric value (y-scale = ratio * x-scale)

    Arguments

    Type IntentOptional Attributes Name
    real(kind=wp), intent(in) :: ratio

Functions

public function get_active_axis() result(axis_name)

Return the name of the currently active axes.

Arguments

None

Return Value character(len=10)


Subroutines

public subroutine xlabel(label_text)

Set the x-axis label text. Routes to subplot or figure level.

Arguments

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

public subroutine ylabel(label_text)

Set the y-axis label text. Routes to subplot or figure level.

Arguments

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

public subroutine title(title_text)

Set the title for the current axes. Routes to subplot or figure level.

Arguments

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

public subroutine suptitle(title_text, fontsize)

Set a centered figure-level title above all subplots

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: title_text
real(kind=wp), intent(in), optional :: fontsize

public subroutine legend(loc, box, fontsize, position)

Display figure legend (matplotlib-compatible)

Read more…

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in), optional :: loc
logical, intent(in), optional :: box
integer, intent(in), optional :: fontsize
character(len=*), intent(in), optional :: position

public subroutine grid(visible, which, axis, alpha, linestyle, enabled)

Toggle or style grid lines (matplotlib-compatible)

Read more…

Arguments

Type IntentOptional Attributes Name
logical, intent(in), optional :: visible
character(len=*), intent(in), optional :: which
character(len=*), intent(in), optional :: axis
real(kind=wp), intent(in), optional :: alpha
character(len=*), intent(in), optional :: linestyle
logical, intent(in), optional :: enabled

public subroutine xlim(xmin, xmax)

Set the x-axis display limits.

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: xmin
real(kind=wp), intent(in) :: xmax

public subroutine ylim(ymin, ymax)

Set the y-axis display limits.

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: ymin
real(kind=wp), intent(in) :: ymax

public subroutine set_xscale(scale, linthresh, threshold, base, linscale)

Set x-axis scale (matplotlib-compatible)

Read more…

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: scale
real(kind=wp), intent(in), optional :: linthresh
real(kind=wp), intent(in), optional :: threshold
real(kind=wp), intent(in), optional :: base
real(kind=wp), intent(in), optional :: linscale

public subroutine set_yscale(scale, linthresh, threshold, base, linscale)

Set y-axis scale (matplotlib-compatible); see set_xscale for kwargs

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: scale
real(kind=wp), intent(in), optional :: linthresh
real(kind=wp), intent(in), optional :: threshold
real(kind=wp), intent(in), optional :: base
real(kind=wp), intent(in), optional :: linscale

public subroutine xscale(scale, linthresh, threshold, base, linscale)

matplotlib pyplot alias for set_xscale

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: scale
real(kind=wp), intent(in), optional :: linthresh
real(kind=wp), intent(in), optional :: threshold
real(kind=wp), intent(in), optional :: base
real(kind=wp), intent(in), optional :: linscale

public subroutine yscale(scale, linthresh, threshold, base, linscale)

matplotlib pyplot alias for set_yscale

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: scale
real(kind=wp), intent(in), optional :: linthresh
real(kind=wp), intent(in), optional :: threshold
real(kind=wp), intent(in), optional :: base
real(kind=wp), intent(in), optional :: linscale

public subroutine set_line_width(width)

Set the default line width for subsequent plots.

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: width

public subroutine set_ydata(ydata)

Replace the y-data of the first plot line.

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in), contiguous :: ydata(:)

public subroutine use_axis(axis_name)

Switch the active axes by name.

Arguments

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

public subroutine minorticks_on()

Enable minor ticks on both axes (matplotlib-compatible)

Arguments

None

public subroutine tight_layout(pad, w_pad, h_pad)

Automatically adjust subplot parameters to give specified padding

Read more…

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in), optional :: pad
real(kind=wp), intent(in), optional :: w_pad
real(kind=wp), intent(in), optional :: h_pad

public subroutine axhline(y, xmin, xmax, color, linestyle, linewidth, label)

Draw a horizontal reference line at data value y (matplotlib-compatible)

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: y
real(kind=wp), intent(in), optional :: xmin
real(kind=wp), intent(in), optional :: xmax
character(len=*), intent(in), optional :: color
character(len=*), intent(in), optional :: linestyle
real(kind=wp), intent(in), optional :: linewidth
character(len=*), intent(in), optional :: label

public subroutine axvline(x, ymin, ymax, color, linestyle, linewidth, label)

Draw a vertical reference line at data value x (matplotlib-compatible)

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: x
real(kind=wp), intent(in), optional :: ymin
real(kind=wp), intent(in), optional :: ymax
character(len=*), intent(in), optional :: color
character(len=*), intent(in), optional :: linestyle
real(kind=wp), intent(in), optional :: linewidth
character(len=*), intent(in), optional :: label

public subroutine hlines(y, xmin, xmax, colors, linestyles, linewidth, label)

Draw one or more horizontal lines at y values between xmin and xmax

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in), contiguous :: y(:)
real(kind=wp), intent(in) :: xmin
real(kind=wp), intent(in) :: xmax
character(len=*), intent(in), optional :: colors
character(len=*), intent(in), optional :: linestyles
real(kind=wp), intent(in), optional :: linewidth
character(len=*), intent(in), optional :: label

public subroutine vlines(x, ymin, ymax, colors, linestyles, linewidth, label)

Draw one or more vertical lines at x values between ymin and ymax

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in), contiguous :: x(:)
real(kind=wp), intent(in) :: ymin
real(kind=wp), intent(in) :: ymax
character(len=*), intent(in), optional :: colors
character(len=*), intent(in), optional :: linestyles
real(kind=wp), intent(in), optional :: linewidth
character(len=*), intent(in), optional :: label

public subroutine set_xticks(positions, labels)

Set custom x-axis tick positions and optionally labels

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in), contiguous :: positions(:)
character(len=*), intent(in), optional :: labels(:)

public subroutine set_yticks(positions, labels)

Set custom y-axis tick positions and optionally labels

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in), contiguous :: positions(:)
character(len=*), intent(in), optional :: labels(:)