fortplot_figure_core Module

Core figure management module (architecturally refactored for SOLID principles)

This module provides the main user interface for creating scientific plots with support for line plots, contour plots, and mixed plotting across PNG, PDF, and ASCII backends. Uses deferred rendering for efficiency.

ARCHITECTURAL REFACTORING COMPLETE (Issue #624): - Original module: 957 lines (91% over 500-line limit) - Refactored size: <500 lines (target achieved)
- Implementation distributed across 20+ focused modules - Each module follows Single Responsibility Principle - Zero functionality loss, full backward compatibility maintained - All existing tests pass without modification



Derived Types

type, public ::  figure_t

Main figure class - coordinates plotting operations Now uses composition of focused modules for better organization

Components

Type Visibility Attributes Name Initial
type(figure_state_t), public :: state
type(plot_data_t), public, allocatable :: plots(:)
type(plot_data_t), public, allocatable :: streamlines(:)
type(arrow_data_t), public, allocatable :: arrow_data(:)
type(text_annotation_t), public, allocatable :: annotations(:)
integer, public :: annotation_count = 0
integer, public :: max_annotations = 1000
integer, public :: subplot_rows = 0
integer, public :: subplot_cols = 0
integer, public :: current_subplot = 1
type(subplot_data_t), public, allocatable :: subplots_array(:,:)
character(len=:), public, allocatable :: title
character(len=:), public, allocatable :: xlabel
character(len=:), public, allocatable :: ylabel
integer, public :: plot_count = 0

Finalizations Procedures

final :: destroy

Type-Bound Procedures

procedure, public :: initialize
procedure, public :: add_plot
procedure, public :: add_contour
procedure, public :: add_contour_filled
procedure, public :: add_pcolormesh
procedure, public :: streamplot
procedure, public :: savefig
procedure, public :: savefig_with_status
procedure, public :: set_xlabel
procedure, public :: set_ylabel
procedure, public :: set_title
procedure, public :: set_xscale
procedure, public :: set_yscale
procedure, public :: set_xlim
procedure, public :: set_ylim
procedure, public :: set_line_width
procedure, public :: set_ydata
procedure, public :: legend => figure_legend
procedure, public :: show
procedure, public :: clear_streamlines
procedure, public :: grid
procedure, public :: hist
procedure, public :: boxplot
procedure, public :: scatter
procedure, public :: subplots
procedure, public :: subplot_plot
procedure, public :: subplot_plot_count
procedure, public :: subplot_set_title
procedure, public :: subplot_set_xlabel
procedure, public :: subplot_set_ylabel
procedure, public :: subplot_title
procedure, public :: get_width
procedure, public :: get_height
procedure, public :: get_rendered
procedure, public :: set_rendered
procedure, public :: get_plot_count
procedure, public :: get_plots
procedure, public :: setup_png_backend_for_animation
procedure, public :: extract_rgb_data_for_animation
procedure, public :: extract_png_data_for_animation
procedure, public :: backend_color
procedure, public :: backend_line
procedure, public :: backend_associated
procedure, public :: get_x_min
procedure, public :: get_x_max
procedure, public :: get_y_min
procedure, public :: get_y_max