plot_context Derived Type

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
real(kind=wp), public :: view_azim = -1.0471975511965976_wp
real(kind=wp), public :: view_elev = 0.5235987755982988_wp
real(kind=wp), public :: view_dist = 10.0_wp
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

  • subroutine line_interface(this, x1, y1, x2, y2) Prototype

    Arguments

    Type IntentOptional Attributes Name
    class(plot_context), intent(inout) :: this
    real(kind=wp), intent(in) :: x1
    real(kind=wp), intent(in) :: y1
    real(kind=wp), intent(in) :: x2
    real(kind=wp), intent(in) :: y2

procedure(color_interface), public, deferred :: color

  • subroutine color_interface(this, r, g, b) Prototype

    Arguments

    Type IntentOptional Attributes Name
    class(plot_context), intent(inout) :: this
    real(kind=wp), intent(in) :: r
    real(kind=wp), intent(in) :: g
    real(kind=wp), intent(in) :: b

procedure(text_interface), public, deferred :: text

  • subroutine text_interface(this, x, y, text) Prototype

    Arguments

    Type IntentOptional Attributes Name
    class(plot_context), intent(inout) :: this
    real(kind=wp), intent(in) :: x
    real(kind=wp), intent(in) :: y
    character(len=*), intent(in) :: text

procedure(save_interface), public, deferred :: save

  • subroutine save_interface(this, filename) Prototype

    Arguments

    Type IntentOptional Attributes Name
    class(plot_context), intent(inout) :: this
    character(len=*), intent(in) :: filename

procedure(line_width_interface), public, deferred :: set_line_width

  • subroutine line_width_interface(this, width) Prototype

    Arguments

    Type IntentOptional Attributes Name
    class(plot_context), intent(inout) :: this
    real(kind=wp), intent(in) :: width

procedure(line_style_interface), public, deferred :: set_line_style

  • subroutine line_style_interface(this, style) Prototype

    Arguments

    Type IntentOptional Attributes Name
    class(plot_context), intent(inout) :: this
    character(len=*), intent(in) :: style

procedure(marker_interface), public, deferred :: draw_marker

  • subroutine marker_interface(this, x, y, style, size) Prototype

    Arguments

    Type IntentOptional Attributes Name
    class(plot_context), intent(inout) :: this
    real(kind=wp), intent(in) :: x
    real(kind=wp), intent(in) :: y
    character(len=*), intent(in) :: style
    real(kind=wp), intent(in), optional :: size

procedure(marker_colors_interface), public, deferred :: set_marker_colors

  • subroutine marker_colors_interface(this, edge_r, edge_g, edge_b, face_r, face_g, face_b) Prototype

    Arguments

    Type IntentOptional Attributes Name
    class(plot_context), intent(inout) :: this
    real(kind=wp), intent(in) :: edge_r
    real(kind=wp), intent(in) :: edge_g
    real(kind=wp), intent(in) :: edge_b
    real(kind=wp), intent(in) :: face_r
    real(kind=wp), intent(in) :: face_g
    real(kind=wp), intent(in) :: face_b

procedure(marker_colors_alpha_interface), public, deferred :: set_marker_colors_with_alpha

  • subroutine marker_colors_alpha_interface(this, edge_r, edge_g, edge_b, edge_alpha, face_r, face_g, face_b, face_alpha) Prototype

    Arguments

    Type IntentOptional Attributes Name
    class(plot_context), intent(inout) :: this
    real(kind=wp), intent(in) :: edge_r
    real(kind=wp), intent(in) :: edge_g
    real(kind=wp), intent(in) :: edge_b
    real(kind=wp), intent(in) :: edge_alpha
    real(kind=wp), intent(in) :: face_r
    real(kind=wp), intent(in) :: face_g
    real(kind=wp), intent(in) :: face_b
    real(kind=wp), intent(in) :: face_alpha

procedure(arrow_interface), public, deferred :: draw_arrow

  • subroutine arrow_interface(this, x, y, dx, dy, size, style) Prototype

    Arguments

    Type IntentOptional Attributes Name
    class(plot_context), intent(inout) :: this
    real(kind=wp), intent(in) :: x
    real(kind=wp), intent(in) :: y
    real(kind=wp), intent(in) :: dx
    real(kind=wp), intent(in) :: dy
    real(kind=wp), intent(in) :: size
    character(len=*), intent(in) :: style

procedure(arrowhead_interface), public, deferred :: draw_arrowhead

  • subroutine arrowhead_interface(this, x, y, dx, dy, size, style) Prototype

    Draw an arrowhead glyph only (no shaft). (x,y) is the tip in data coordinates; (dx,dy) is a unit direction in data coordinates pointing into the tip; size is the head scale in pixel-like units, independent of the data range. Used by streamplot, where draw_arrow's data-coord shaft is unwanted.

    Arguments

    Type IntentOptional Attributes Name
    class(plot_context), intent(inout) :: this
    real(kind=wp), intent(in) :: x
    real(kind=wp), intent(in) :: y
    real(kind=wp), intent(in) :: dx
    real(kind=wp), intent(in) :: dy
    real(kind=wp), intent(in) :: size
    character(len=*), intent(in) :: style

procedure(ascii_output_interface), public, deferred :: get_ascii_output

Additional polymorphic methods to eliminate SELECT TYPE violations

  • function ascii_output_interface(this) result(output) Prototype

    Arguments

    Type IntentOptional Attributes Name
    class(plot_context), intent(in) :: this

    Return Value character(len=:), allocatable

procedure(get_width_scale_interface), public, deferred :: get_width_scale

  • function get_width_scale_interface(this) result(scale) Prototype

    Arguments

    Type IntentOptional Attributes Name
    class(plot_context), intent(in) :: this

    Return Value real(kind=wp)

procedure(get_height_scale_interface), public, deferred :: get_height_scale

  • function get_height_scale_interface(this) result(scale) Prototype

    Arguments

    Type IntentOptional Attributes Name
    class(plot_context), intent(in) :: this

    Return Value real(kind=wp)

procedure(fill_quad_interface), public, deferred :: fill_quad

  • subroutine fill_quad_interface(this, x_quad, y_quad) Prototype

    Arguments

    Type IntentOptional Attributes Name
    class(plot_context), intent(inout) :: this
    real(kind=wp), intent(in) :: x_quad(4)
    real(kind=wp), intent(in) :: y_quad(4)

procedure(fill_heatmap_interface), public, deferred :: fill_heatmap

  • subroutine fill_heatmap_interface(this, x_grid, y_grid, z_grid, z_min, z_max, colormap_name) Prototype

    Arguments

    Type IntentOptional Attributes Name
    class(plot_context), intent(inout) :: this
    real(kind=wp), intent(in), contiguous :: x_grid(:)
    real(kind=wp), intent(in), contiguous :: y_grid(:)
    real(kind=wp), intent(in), contiguous :: z_grid(:,:)
    real(kind=wp), intent(in) :: z_min
    real(kind=wp), intent(in) :: z_max
    character(len=*), intent(in), optional :: colormap_name

procedure(extract_rgb_data_interface), public, deferred :: extract_rgb_data

  • subroutine extract_rgb_data_interface(this, width, height, rgb_data) Prototype

    Arguments

    Type IntentOptional Attributes Name
    class(plot_context), intent(in) :: this
    integer, intent(in) :: width
    integer, intent(in) :: height
    real(kind=wp), intent(out) :: rgb_data(width,height,3)

procedure(get_png_data_interface), public, deferred :: get_png_data_backend

  • subroutine get_png_data_interface(this, width, height, png_data, status) Prototype

    Arguments

    Type IntentOptional Attributes Name
    class(plot_context), intent(in) :: this
    integer, intent(in) :: width
    integer, intent(in) :: height
    integer(kind=1), intent(out), allocatable :: png_data(:)
    integer, intent(out) :: status

procedure(prepare_3d_data_interface), public, deferred :: prepare_3d_data

  • subroutine prepare_3d_data_interface(this, plots) Prototype

    Arguments

    Type IntentOptional Attributes Name
    class(plot_context), intent(inout) :: this
    type(plot_data_t), intent(in) :: plots(:)

procedure(render_ylabel_interface), public, deferred :: render_ylabel

  • subroutine render_ylabel_interface(this, ylabel) Prototype

    Arguments

    Type IntentOptional Attributes Name
    class(plot_context), intent(inout) :: this
    character(len=*), intent(in) :: ylabel

procedure(draw_axes_and_labels_interface), public, deferred :: draw_axes_and_labels_backend

  • subroutine draw_axes_and_labels_interface(this, xscale, yscale, symlog_threshold, x_min, x_max, y_min, y_max, title, xlabel, ylabel, x_date_format, y_date_format, z_min, z_max, has_3d_plots) Prototype

    Arguments

    Type IntentOptional Attributes Name
    class(plot_context), intent(inout) :: this
    character(len=*), intent(in) :: xscale
    character(len=*), intent(in) :: yscale
    real(kind=wp), intent(in) :: symlog_threshold
    real(kind=wp), intent(in) :: x_min
    real(kind=wp), intent(in) :: x_max
    real(kind=wp), intent(in) :: y_min
    real(kind=wp), intent(in) :: y_max
    character(len=:), intent(in), optional, allocatable :: title
    character(len=:), intent(in), optional, allocatable :: xlabel
    character(len=:), intent(in), optional, allocatable :: ylabel
    character(len=*), intent(in), optional :: x_date_format
    character(len=*), intent(in), optional :: y_date_format
    real(kind=wp), intent(in), optional :: z_min
    real(kind=wp), intent(in), optional :: z_max
    logical, intent(in) :: has_3d_plots

procedure(save_coordinates_interface), public, deferred :: save_coordinates

  • subroutine save_coordinates_interface(this, x_min, x_max, y_min, y_max) Prototype

    Arguments

    Type IntentOptional Attributes Name
    class(plot_context), intent(in) :: this
    real(kind=wp), intent(out) :: x_min
    real(kind=wp), intent(out) :: x_max
    real(kind=wp), intent(out) :: y_min
    real(kind=wp), intent(out) :: y_max

procedure(set_coordinates_interface), public, deferred :: set_coordinates

  • subroutine set_coordinates_interface(this, x_min, x_max, y_min, y_max) Prototype

    Arguments

    Type IntentOptional Attributes Name
    class(plot_context), intent(inout) :: this
    real(kind=wp), intent(in) :: x_min
    real(kind=wp), intent(in) :: x_max
    real(kind=wp), intent(in) :: y_min
    real(kind=wp), intent(in) :: y_max

procedure(render_axes_interface), public, deferred :: render_axes

Blank a horizontal run of cells behind a text block so overlays such as legends read against clear background. Raster/vector backends composite text on top already, so the base implementation is a no-op.

  • subroutine render_axes_interface(this, title_text, xlabel_text, ylabel_text) Prototype

    Arguments

    Type IntentOptional Attributes Name
    class(plot_context), intent(inout) :: this
    character(len=*), intent(in), optional :: title_text
    character(len=*), intent(in), optional :: xlabel_text
    character(len=*), intent(in), optional :: ylabel_text

procedure, public :: clear_text_background => context_clear_text_background

Draw text as a fixed-position overlay. Raster/vector backends reuse their normal text path; the ASCII backend overrides this to place the glyphs at the exact cell without the auto-shift its buffered text path applies, so stacked legend rows never blend together.

  • private subroutine context_clear_text_background(this, x, y, width)

    Default no-op: backends that composite text over graphics need no explicit background clearing.

    Arguments

    Type IntentOptional Attributes Name
    class(plot_context), intent(inout) :: this
    real(kind=wp), intent(in) :: x
    real(kind=wp), intent(in) :: y
    integer, intent(in) :: width

procedure, public :: draw_text_overlay => context_draw_text_overlay

Select the text-backend charset ('ascii' or 'braille'). Only the text backend carries subpixel dots; raster/vector backends ignore it.

  • private subroutine context_draw_text_overlay(this, x, y, text)

    Default overlay: reuse the backend's normal text path.

    Arguments

    Type IntentOptional Attributes Name
    class(plot_context), intent(inout) :: this
    real(kind=wp), intent(in) :: x
    real(kind=wp), intent(in) :: y
    character(len=*), intent(in) :: text

procedure, public :: set_text_charset => context_set_text_charset

Select the text-backend ANSI color mode. Only the text backend emits escapes; raster/vector backends ignore it (#2062).

  • private subroutine context_set_text_charset(this, charset)

    Default no-op: only the text backend renders subpixel charsets.

    Arguments

    Type IntentOptional Attributes Name
    class(plot_context), intent(inout) :: this
    character(len=*), intent(in) :: charset

procedure, public :: set_text_color_mode => context_set_text_color_mode

  • private subroutine context_set_text_color_mode(this, mode)

    Default no-op: only the text backend emits ANSI color escapes.

    Arguments

    Type IntentOptional Attributes Name
    class(plot_context), intent(inout) :: this
    character(len=*), intent(in) :: mode