fortplot_figure_plot_management Module

Figure plot data management module

Single Responsibility: Manage plot data storage and operations Extracted from fortplot_figure_core to improve modularity



Functions

public pure function next_plot_color(state) result(color)

Determine the next color from the figure palette using plot count

Arguments

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

Return Value real(kind=wp), (3)


Subroutines

public subroutine validate_plot_data(x, y, label)

Validate plot data and provide informative warnings for edge cases Added for Issue #432: Better user feedback for problematic data Fixed Issue #833: Reduced warning verbosity for constant data

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: x(:)
real(kind=wp), intent(in) :: y(:)
character(len=*), intent(in), optional :: label

public subroutine add_line_plot_data(plots, plot_count, max_plots, x, y, label, linestyle, color, marker)

Add line plot data to internal storage with edge case validation Fixed Issue #432: Added data validation for better user feedback

Arguments

Type IntentOptional Attributes Name
type(plot_data_t), intent(inout) :: plots(:)
integer, intent(inout) :: plot_count
integer, intent(in) :: max_plots
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) :: color(3)
character(len=*), intent(in), optional :: marker

public subroutine add_fill_between_plot_data(plots, plot_count, max_plots, x, upper, lower, mask, color, alpha)

Store a fill_between polygon for rendering

Arguments

Type IntentOptional Attributes Name
type(plot_data_t), intent(inout) :: plots(:)
integer, intent(inout) :: plot_count
integer, intent(in) :: max_plots
real(kind=wp), intent(in) :: x(:)
real(kind=wp), intent(in) :: upper(:)
real(kind=wp), intent(in) :: lower(:)
logical, intent(in), optional :: mask(:)
real(kind=wp), intent(in) :: color(3)
real(kind=wp), intent(in), optional :: alpha

public subroutine add_contour_plot_data(plots, plot_count, max_plots, colors, x_grid, y_grid, z_grid, levels, label)

Add contour plot data to internal storage

Arguments

Type IntentOptional Attributes Name
type(plot_data_t), intent(inout) :: plots(:)
integer, intent(inout) :: plot_count
integer, intent(in) :: max_plots
real(kind=wp), intent(in) :: colors(:,:)
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 add_colored_contour_plot_data(plots, plot_count, max_plots, x_grid, y_grid, z_grid, levels, colormap, show_colorbar, label)

Add colored contour plot data

Arguments

Type IntentOptional Attributes Name
type(plot_data_t), intent(inout) :: plots(:)
integer, intent(inout) :: plot_count
integer, intent(in) :: max_plots
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 add_surface_plot_data(plots, plot_count, max_plots, colors, x_grid, y_grid, z_grid, label, colormap, show_colorbar, alpha, edgecolor, linewidth)

Add 3D surface plot data using structured grid storage

Arguments

Type IntentOptional Attributes Name
type(plot_data_t), intent(inout) :: plots(:)
integer, intent(inout) :: plot_count
integer, intent(in) :: max_plots
real(kind=wp), intent(in) :: colors(:,:)
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 add_pcolormesh_plot_data(plots, plot_count, max_plots, x, y, c, colormap, vmin, vmax, edgecolors, linewidths)

Add pcolormesh plot data

Arguments

Type IntentOptional Attributes Name
type(plot_data_t), intent(inout) :: plots(:)
integer, intent(inout) :: plot_count
integer, intent(in) :: max_plots
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 generate_default_contour_levels(plot_data)

Generate default contour levels

Arguments

Type IntentOptional Attributes Name
type(plot_data_t), intent(inout) :: plot_data

public subroutine setup_figure_legend(legend_data, show_legend, plots, plot_count, location, backend_name)

Setup figure legend

Arguments

Type IntentOptional Attributes Name
type(legend_t), intent(inout) :: legend_data
logical, intent(inout) :: show_legend
type(plot_data_t), intent(in) :: plots(:)
integer, intent(in) :: plot_count
character(len=*), intent(in), optional :: location
character(len=*), intent(in), optional :: backend_name

public subroutine update_plot_ydata(plots, plot_count, plot_index, y_new)

Update y data for an existing plot

Arguments

Type IntentOptional Attributes Name
type(plot_data_t), intent(inout) :: plots(:)
integer, intent(in) :: plot_count
integer, intent(in) :: plot_index
real(kind=wp), intent(in) :: y_new(:)