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, plots) result(color)

Next colour from the line cycle (plot/axhline/axvline). matplotlib advances the line property cycle only for line artists; scatter and contour draw from the patch/colormap path and never touch it. When the plots array is supplied, count existing line artists so an intervening scatter or contour does not skip a colour. Without it, fall back to the global plot index for callers that have no array in scope.

Arguments

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

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

public pure function next_patch_color(state, plots) result(color)

Next colour from the patch cycle (scatter/fill/bar/histogram). matplotlib cycles patches independently of lines, so the first scatter or filled area is tab:blue even when a line was drawn before it, and a following line plot still starts at tab:blue. Counts existing patch artists rather than the global plot index.

Arguments

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

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


Subroutines

public subroutine validate_plot_data(x, y, label)

Arguments

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

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

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), contiguous :: x(:)
real(kind=wp), intent(in), contiguous :: y(:)
character(len=*), intent(in), optional :: label
character(len=*), intent(in), optional :: linestyle
real(kind=wp), intent(in) :: color(3)
real(kind=wp), intent(in), optional :: alpha
character(len=*), intent(in), optional :: marker

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

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), contiguous :: x(:)
real(kind=wp), intent(in), contiguous :: upper(:)
real(kind=wp), intent(in), contiguous :: lower(:)
logical, intent(in), optional :: mask(:)
real(kind=wp), intent(in) :: color(3)
real(kind=wp), intent(in), optional :: alpha

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

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), contiguous :: y_new(:)