fortplot_figure_plots Module

Plot creation methods for figure_t

This module contains the core plot creation functionality extracted from fortplot_figure_core to achieve QADS compliance (<500 lines).

Single Responsibility: Handle creation of different plot types (line plots, contours, filled contours, pcolormesh)



Variables

Type Visibility Attributes Name Initial
real(kind=wp), public, parameter :: PI = acos(-1.0_wp)

Derived Types

type, public ::  pie_prepared_t

Components

Type Visibility Attributes Name Initial
integer, public :: slice_count = 0
real(kind=wp), public :: total = 0.0_wp
integer, public, allocatable :: indices(:)
real(kind=wp), public, allocatable :: explode(:)
logical, public :: valid = .false.

Subroutines

public subroutine figure_add_plot(plots, state, x, y, label, linestyle, color)

Add a line plot to the figure

Arguments

Type IntentOptional Attributes Name
type(plot_data_t), intent(inout) :: plots(:)
type(figure_state_t), intent(inout) :: state
real(kind=wp), intent(in) :: x(:)
real(kind=wp), intent(in) :: y(:)
character(len=*), intent(in), optional :: label
character(len=*), intent(in), optional :: linestyle
real(kind=wp), intent(in), optional :: color(3)

public subroutine figure_add_contour(plots, state, x_grid, y_grid, z_grid, levels, label)

Add a contour plot to the figure

Arguments

Type IntentOptional Attributes Name
type(plot_data_t), intent(inout) :: plots(:)
type(figure_state_t), intent(inout) :: state
real(kind=wp), intent(in) :: x_grid(:)
real(kind=wp), intent(in) :: y_grid(:)
real(kind=wp), intent(in) :: z_grid(:,:)
real(kind=wp), intent(in), optional :: levels(:)
character(len=*), intent(in), optional :: label

public subroutine figure_add_contour_filled(plots, state, x_grid, y_grid, z_grid, levels, colormap, show_colorbar, label)

Add a filled contour plot with color mapping

Arguments

Type IntentOptional Attributes Name
type(plot_data_t), intent(inout) :: plots(:)
type(figure_state_t), intent(inout) :: state
real(kind=wp), intent(in) :: x_grid(:)
real(kind=wp), intent(in) :: y_grid(:)
real(kind=wp), intent(in) :: z_grid(:,:)
real(kind=wp), intent(in), optional :: levels(:)
character(len=*), intent(in), optional :: colormap
logical, intent(in), optional :: show_colorbar
character(len=*), intent(in), optional :: label

public subroutine figure_add_surface(plots, state, x_grid, y_grid, z_grid, label, colormap, show_colorbar, alpha, edgecolor, linewidth)

Add a 3D surface plot to the figure

Arguments

Type IntentOptional Attributes Name
type(plot_data_t), intent(inout) :: plots(:)
type(figure_state_t), intent(inout) :: state
real(kind=wp), intent(in) :: x_grid(:)
real(kind=wp), intent(in) :: y_grid(:)
real(kind=wp), intent(in) :: z_grid(:,:)
character(len=*), intent(in), optional :: label
character(len=*), intent(in), optional :: colormap
logical, intent(in), optional :: show_colorbar
real(kind=wp), intent(in), optional :: alpha
real(kind=wp), intent(in), optional :: edgecolor(3)
real(kind=wp), intent(in), optional :: linewidth

public subroutine figure_add_pcolormesh(plots, state, x, y, c, colormap, vmin, vmax, edgecolors, linewidths)

Add a pcolormesh plot

Arguments

Type IntentOptional Attributes Name
type(plot_data_t), intent(inout) :: plots(:)
type(figure_state_t), intent(inout) :: state
real(kind=wp), intent(in) :: x(:)
real(kind=wp), intent(in) :: y(:)
real(kind=wp), intent(in) :: c(:,:)
character(len=*), intent(in), optional :: colormap
real(kind=wp), intent(in), optional :: vmin
real(kind=wp), intent(in), optional :: vmax
real(kind=wp), intent(in), optional :: edgecolors(3)
real(kind=wp), intent(in), optional :: linewidths

public subroutine figure_add_fill_between(plots, state, x, upper, lower, mask, color_string, alpha)

Add an area fill between two curves

Arguments

Type IntentOptional Attributes Name
type(plot_data_t), intent(inout) :: plots(:)
type(figure_state_t), intent(inout) :: state
real(kind=wp), intent(in) :: x(:)
real(kind=wp), intent(in) :: upper(:)
real(kind=wp), intent(in) :: lower(:)
logical, intent(in), optional :: mask(:)
character(len=*), intent(in), optional :: color_string
real(kind=wp), intent(in), optional :: alpha

public subroutine figure_add_pie(plots, state, values, labels, startangle, color_strings, explode, autopct)

Store pie chart slices using polar wedges with optional explode & colors

Arguments

Type IntentOptional Attributes Name
type(plot_data_t), intent(inout) :: plots(:)
type(figure_state_t), intent(inout) :: state
real(kind=wp), intent(in) :: values(:)
character(len=*), intent(in), optional :: labels(:)
real(kind=wp), intent(in), optional :: startangle
character(len=*), intent(in), optional :: color_strings(:)
real(kind=wp), intent(in), optional :: explode(:)
character(len=*), intent(in), optional :: autopct