fortplot_figure_initialization Module

Figure initialization and configuration module

Single Responsibility: Initialize figures and manage basic configuration Extracted from fortplot_figure_core to reduce file size and improve modularity



Derived Types

type, public ::  figure_state_t

Figure state and configuration data Encapsulates all configuration and state management

Components

Type Visibility Attributes Name Initial
class(plot_context), public, allocatable :: backend
integer, public :: plot_count = 0
logical, public :: rendered = .false.
integer, public :: width = 640
integer, public :: height = 480
real(kind=wp), public :: margin_left = 0.15_wp
real(kind=wp), public :: margin_right = 0.05_wp
real(kind=wp), public :: margin_bottom = 0.15_wp
real(kind=wp), public :: margin_top = 0.05_wp
character(len=10), public :: xscale = 'linear'
character(len=10), public :: yscale = 'linear'
real(kind=wp), public :: symlog_threshold = 1.0_wp
real(kind=wp), public :: x_min
real(kind=wp), public :: x_max
real(kind=wp), public :: y_min
real(kind=wp), public :: y_max
real(kind=wp), public :: x_min_transformed
real(kind=wp), public :: x_max_transformed
real(kind=wp), public :: y_min_transformed
real(kind=wp), public :: y_max_transformed
logical, public :: xlim_set = .false.
logical, public :: ylim_set = .false.
character(len=:), public, allocatable :: title
character(len=:), public, allocatable :: xlabel
character(len=:), public, allocatable :: ylabel
real(kind=wp), public, dimension(3,6) :: colors = reshape([0.0_wp, 0.447_wp, 0.698_wp, 0.0_wp, 0.619_wp, 0.451_wp, 0.835_wp, 0.369_wp, 0.0_wp, 0.8_wp, 0.475_wp, 0.655_wp, 0.941_wp, 0.894_wp, 0.259_wp, 0.337_wp, 0.702_wp, 0.914_wp], [3, 6])
type(legend_t), public :: legend_data
logical, public :: show_legend = .false.
integer, public :: max_plots = 500
real(kind=wp), public :: current_line_width = 1.0_wp
logical, public :: has_error = .false.
logical, public :: grid_enabled = .false.
character(len=10), public :: grid_which = 'both'
character(len=1), public :: grid_axis = 'b'
real(kind=wp), public :: grid_alpha = 0.3_wp
character(len=10), public :: grid_linestyle = '-'

Subroutines

public subroutine initialize_figure_state(state, width, height, backend)

Initialize figure state with specified parameters

Arguments

Type IntentOptional Attributes Name
type(figure_state_t), intent(inout) :: state
integer, intent(in), optional :: width
integer, intent(in), optional :: height
character(len=*), intent(in), optional :: backend

public subroutine reset_figure_state(state)

Reset figure state to initial values

Arguments

Type IntentOptional Attributes Name
type(figure_state_t), intent(inout) :: state

public subroutine setup_figure_backend(state, backend_name)

Setup or change the figure backend

Arguments

Type IntentOptional Attributes Name
type(figure_state_t), intent(inout) :: state
character(len=*), intent(in) :: backend_name

public subroutine configure_figure_dimensions(state, width, height)

Configure figure dimensions

Arguments

Type IntentOptional Attributes Name
type(figure_state_t), intent(inout) :: state
integer, intent(in), optional :: width
integer, intent(in), optional :: height

public subroutine set_figure_labels(state, title, xlabel, ylabel)

Set figure labels

Arguments

Type IntentOptional Attributes Name
type(figure_state_t), intent(inout) :: state
character(len=*), intent(in), optional :: title
character(len=*), intent(in), optional :: xlabel
character(len=*), intent(in), optional :: ylabel

public subroutine set_figure_scales(state, xscale, yscale, threshold)

Set axis scale types

Arguments

Type IntentOptional Attributes Name
type(figure_state_t), intent(inout) :: state
character(len=*), intent(in), optional :: xscale
character(len=*), intent(in), optional :: yscale
real(kind=wp), intent(in), optional :: threshold

public subroutine set_figure_limits(state, x_min, x_max, y_min, y_max)

Set axis limits

Arguments

Type IntentOptional Attributes Name
type(figure_state_t), intent(inout) :: state
real(kind=wp), intent(in), optional :: x_min
real(kind=wp), intent(in), optional :: x_max
real(kind=wp), intent(in), optional :: y_min
real(kind=wp), intent(in), optional :: y_max