fortplot_matplotlib_io Module

File I/O and display operations for matplotlib-compatible API Contains figure management, saving, and showing functions



Interfaces

public interface show

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

    Show data as a simple plot with optional labels

    Arguments

    Type IntentOptional Attributes Name
    real(kind=8), intent(in), dimension(:) :: x
    real(kind=8), intent(in), dimension(:) :: 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
  • private subroutine show_figure(blocking)

    Display the global figure (pyplot-style)

    Arguments

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

Functions

public function get_global_figure() result(global_fig)

Get reference to the global figure for testing access to arrow data This allows tests to access fig%arrow_data without making fig public

Arguments

None

Return Value class(figure_t), pointer


Subroutines

public subroutine ensure_global_figure_initialized()

Ensure global figure is initialized before use (matplotlib compatibility) Auto-initializes with default dimensions if not already initialized

Arguments

None

public subroutine figure(num, figsize, dpi)

Create or activate a figure with optional size and DPI settings

Arguments

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

public subroutine subplot(nrows, ncols, index)

Create subplot arrangement (simplified for single axis) Currently implements single plot behavior

Arguments

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

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

Save the global figure to a file (pyplot-style)

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 figure with status return (error handling version)

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_viewer(blocking)

Display figure using system viewer (cross-platform)

Arguments

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