fortplot_context Module

Abstract base class for plotting backends

This module defines the common interface that all plotting backends (PNG, PDF, ASCII) must implement. Provides polymorphic interface for unified plotting operations across different output formats.

Author: fortplot contributors



Derived Types

type, public, abstract ::  plot_context

Components

Type Visibility Attributes Name Initial
integer, public :: width
integer, public :: height
real(kind=wp), public :: x_min
real(kind=wp), public :: x_max
real(kind=wp), public :: y_min
real(kind=wp), public :: y_max
logical, public :: has_rendered_arrows = .false.
logical, public :: uses_vector_arrows = .false.
logical, public :: has_triangular_arrows = .false.

Type-Bound Procedures

procedure(line_interface), public, deferred :: line
procedure(color_interface), public, deferred :: color
procedure(text_interface), public, deferred :: text
procedure(save_interface), public, deferred :: save
procedure(line_width_interface), public, deferred :: set_line_width
procedure(line_style_interface), public, deferred :: set_line_style
procedure(marker_interface), public, deferred :: draw_marker
procedure(marker_colors_interface), public, deferred :: set_marker_colors
procedure(marker_colors_alpha_interface), public, deferred :: set_marker_colors_with_alpha
procedure(arrow_interface), public, deferred :: draw_arrow
procedure(ascii_output_interface), public, deferred :: get_ascii_output

Additional polymorphic methods to eliminate SELECT TYPE violations

procedure(get_width_scale_interface), public, deferred :: get_width_scale
procedure(get_height_scale_interface), public, deferred :: get_height_scale
procedure(fill_quad_interface), public, deferred :: fill_quad
procedure(fill_heatmap_interface), public, deferred :: fill_heatmap
procedure(extract_rgb_data_interface), public, deferred :: extract_rgb_data
procedure(get_png_data_interface), public, deferred :: get_png_data_backend
procedure(prepare_3d_data_interface), public, deferred :: prepare_3d_data
procedure(render_ylabel_interface), public, deferred :: render_ylabel
procedure(draw_axes_and_labels_interface), public, deferred :: draw_axes_and_labels_backend
procedure(save_coordinates_interface), public, deferred :: save_coordinates
procedure(set_coordinates_interface), public, deferred :: set_coordinates
procedure(render_axes_interface), public, deferred :: render_axes

Subroutines

public subroutine setup_canvas(ctx, width, height)

Arguments

Type IntentOptional Attributes Name
class(plot_context), intent(inout) :: ctx
integer, intent(in) :: width
integer, intent(in) :: height