fortplot_matplotlib_session Module

Global figure session helpers shared across matplotlib-compatible wrappers

Provides lifecycle management for the singleton figure used by the matplotlib facade. Responsibilities include creating and reusing the global figure, grid/subplot helpers, and viewer integration utilities.



Functions

public function get_global_figure() result(global_fig)

Return the global figure pointer, initializing on demand

Arguments

None

Return Value class(figure_t), pointer

public function subplots_grid(nrows, ncols) result(axes)

Create a subplot grid and return axis indices in row-major order.

Read more…

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: nrows
integer, intent(in) :: ncols

Return Value integer, allocatable, (:,:)


Subroutines

public subroutine ion()

Enable interactive mode for live terminal visualization

Read more…

Arguments

None

public subroutine ioff()

Disable interactive mode

Arguments

None

public subroutine draw()

Redraw the current figure to terminal (ASCII output)

Read more…

Arguments

None

public subroutine pause(seconds)

Draw the current figure and pause for specified duration

Read more…

Arguments

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

public subroutine ensure_fig_init()

Ensure the global figure exists and is initialized

Arguments

None

public subroutine ensure_global_figure_initialized()

Public wrapper to guarantee the singleton is ready for use

Arguments

None

public subroutine figure(num, figsize, dpi)

Create or reset the shared figure.

Read more…

Arguments

Type IntentOptional Attributes Name
integer, intent(in), optional :: num
real(kind=wp), intent(in), optional, dimension(2) :: figsize
integer, intent(in), optional :: dpi

public subroutine subplot(nrows, ncols, index)

Select a subplot in an nrows by ncols grid.

Read more…

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: nrows
integer, intent(in) :: ncols
integer, intent(in) :: index

public subroutine subplots(nrows, ncols, axes, sharex, sharey)

Initialize a subplot grid.

Read more…

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: nrows
integer, intent(in) :: ncols
integer, intent(out), optional, allocatable :: axes(:,:)
logical, intent(in), optional :: sharex
logical, intent(in), optional :: sharey

public subroutine savefig(filename, dpi, transparent, bbox_inches)

Save the current figure.

Read more…

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: filename
integer, intent(in), optional :: dpi
logical, intent(in), optional :: transparent
character(len=*), intent(in), optional :: bbox_inches

public subroutine savefig_with_status(filename, status, dpi, transparent, bbox_inches)

Save the figure and return a status code.

Read more…

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: filename
integer, intent(out) :: status
integer, intent(in), optional :: dpi
logical, intent(in), optional :: transparent
character(len=*), intent(in), optional :: bbox_inches

public subroutine show_data(x, y, label, title_text, xlabel_text, ylabel_text, blocking)

Show a line plot and optionally apply labels before displaying it.

Read more…

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in), contiguous :: x(:)
real(kind=wp), intent(in), contiguous :: y(:)
character(len=*), intent(in), optional :: label
character(len=*), intent(in), optional :: title_text
character(len=*), intent(in), optional :: xlabel_text
character(len=*), intent(in), optional :: ylabel_text
logical, intent(in), optional :: blocking

public subroutine show_figure(blocking)

Display the current figure.

Read more…

Arguments

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

public subroutine show_viewer(blocking)

Launch the system image viewer for the current figure.

Read more…

Arguments

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