Figure core operations module for fortplot_figure_core
This module handles core plotting operations, rendering pipeline, and plot data management. Extracted from fortplot_figure_core.f90 for better organization following Single Responsibility Principle.
Responsibilities: - Plot operations (add_plot, add_contour, add_pcolormesh, etc.) - Axis configuration (set_xlim, set_ylim, set_xlabel, etc.) - Grid configuration - Legend management - Rendering pipeline coordination
Add a line plot to the figure
| Type | Intent | Optional | 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) | 
Add a contour plot to the figure
| Type | Intent | Optional | 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 | 
Add a filled contour plot with color mapping
| Type | Intent | Optional | 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 | 
Add a 3D surface plot to the figure
| Type | Intent | Optional | 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 | 
Add a pcolormesh plot
| Type | Intent | Optional | 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 | 
Add an area fill between two curves
| Type | Intent | Optional | 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 | 
Add a pie chart to the figure
| Type | Intent | Optional | 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 | 
Add streamline plot to figure using basic algorithm
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(plot_data_t), | intent(inout) | :: | plots(:) | |||
| type(figure_state_t), | intent(inout) | :: | state | |||
| integer, | intent(inout) | :: | plot_count | |||
| real(kind=wp), | intent(in) | :: | x(:) | |||
| real(kind=wp), | intent(in) | :: | y(:) | |||
| real(kind=wp), | intent(in) | :: | u(:,:) | |||
| real(kind=wp), | intent(in) | :: | v(:,:) | |||
| real(kind=wp), | intent(in), | optional | :: | density | ||
| real(kind=wp), | intent(in), | optional | :: | color(3) | 
Create a histogram plot
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(plot_data_t), | intent(inout) | :: | plots(:) | |||
| type(figure_state_t), | intent(inout) | :: | state | |||
| integer, | intent(inout) | :: | plot_count | |||
| real(kind=wp), | intent(in) | :: | data(:) | |||
| integer, | intent(in), | optional | :: | bins | ||
| logical, | intent(in), | optional | :: | density | ||
| character(len=*), | intent(in), | optional | :: | label | ||
| real(kind=wp), | intent(in), | optional | :: | color(3) | 
Create a box plot
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(figure_state_t), | intent(in) | :: | state | |||
| type(plot_data_t), | intent(inout), | allocatable | :: | plots(:) | ||
| integer, | intent(inout) | :: | plot_count | |||
| real(kind=wp), | intent(in) | :: | data(:) | |||
| real(kind=wp), | intent(in), | optional | :: | position | ||
| real(kind=wp), | intent(in), | optional | :: | width | ||
| character(len=*), | intent(in), | optional | :: | label | ||
| logical, | intent(in), | optional | :: | show_outliers | ||
| logical, | intent(in), | optional | :: | horizontal | ||
| character(len=*), | intent(in), | optional | :: | color | ||
| integer, | intent(in) | :: | max_plots | 
Add an efficient scatter plot using a single plot object
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(figure_state_t), | intent(in) | :: | state | |||
| type(plot_data_t), | intent(inout), | allocatable | :: | plots(:) | ||
| integer, | intent(inout) | :: | plot_count | |||
| real(kind=wp), | intent(in) | :: | x(:) | |||
| real(kind=wp), | intent(in) | :: | y(:) | |||
| real(kind=wp), | intent(in), | optional | :: | s(:) | ||
| real(kind=wp), | intent(in), | optional | :: | c(:) | ||
| character(len=*), | intent(in), | optional | :: | marker | ||
| real(kind=wp), | intent(in), | optional | :: | markersize | ||
| real(kind=wp), | intent(in), | optional | :: | color(3) | ||
| character(len=*), | intent(in), | optional | :: | colormap | ||
| real(kind=wp), | intent(in), | optional | :: | vmin | ||
| real(kind=wp), | intent(in), | optional | :: | vmax | ||
| character(len=*), | intent(in), | optional | :: | label | ||
| logical, | intent(in), | optional | :: | show_colorbar | ||
| real(kind=wp), | intent(in) | :: | default_color(3) | 
Set x-axis label
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(figure_state_t), | intent(inout) | :: | state | |||
| character(len=:), | intent(inout), | allocatable | :: | xlabel_target | ||
| character(len=*), | intent(in) | :: | label | 
Set y-axis label
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(figure_state_t), | intent(inout) | :: | state | |||
| character(len=:), | intent(inout), | allocatable | :: | ylabel_target | ||
| character(len=*), | intent(in) | :: | label | 
Set figure title
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(figure_state_t), | intent(inout) | :: | state | |||
| character(len=:), | intent(inout), | allocatable | :: | title_target | ||
| character(len=*), | intent(in) | :: | title | 
Set x-axis scale type
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(figure_state_t), | intent(inout) | :: | state | |||
| character(len=*), | intent(in) | :: | scale | |||
| real(kind=wp), | intent(in), | optional | :: | threshold | 
Set y-axis scale type
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(figure_state_t), | intent(inout) | :: | state | |||
| character(len=*), | intent(in) | :: | scale | |||
| real(kind=wp), | intent(in), | optional | :: | threshold | 
Set x-axis limits
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(figure_state_t), | intent(inout) | :: | state | |||
| real(kind=wp), | intent(in) | :: | x_min | |||
| real(kind=wp), | intent(in) | :: | x_max | 
Set y-axis limits
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(figure_state_t), | intent(inout) | :: | state | |||
| real(kind=wp), | intent(in) | :: | y_min | |||
| real(kind=wp), | intent(in) | :: | y_max | 
Set line width for subsequent plots
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(figure_state_t), | intent(inout) | :: | state | |||
| real(kind=wp), | intent(in) | :: | width | 
Update y data for an existing plot
| Type | Intent | Optional | 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(:) | 
Add legend to figure
| Type | Intent | Optional | 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) | :: | backend_name | 
Enable/disable and configure grid lines
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(figure_state_t), | intent(inout) | :: | state | |||
| logical, | intent(in), | optional | :: | enabled | ||
| character(len=*), | intent(in), | optional | :: | which | ||
| character(len=*), | intent(in), | optional | :: | axis | ||
| real(kind=wp), | intent(in), | optional | :: | alpha | ||
| character(len=*), | intent(in), | optional | :: | linestyle |