fortplot_ascii_elements Module

ASCII terminal plotting backend - Drawing Elements

This module contains specialized drawing functions for ASCII plotting including markers, arrows, heatmaps, legends, and axes.

Author: fortplot contributors



Subroutines

public subroutine draw_ascii_marker(canvas, x, y, style, x_min, x_max, y_min, y_max, plot_width, plot_height)

Arguments

Type IntentOptional Attributes Name
character(len=1), intent(inout) :: canvas(:,:)
real(kind=wp), intent(in) :: x
real(kind=wp), intent(in) :: y
character(len=*), intent(in) :: style
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
integer, intent(in) :: plot_width
integer, intent(in) :: plot_height

public subroutine fill_ascii_heatmap(canvas, x_grid, y_grid, z_grid, z_min, z_max, x_min, x_max, y_min, y_max, plot_width, plot_height)

Fill ASCII canvas with heatmap representation of 2D data

Arguments

Type IntentOptional Attributes Name
character(len=1), intent(inout) :: canvas(:,:)
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) :: z_min
real(kind=wp), intent(in) :: z_max
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
integer, intent(in) :: plot_width
integer, intent(in) :: plot_height

public subroutine draw_ascii_arrow(canvas, x, y, dx, dy, size, style, x_min, x_max, y_min, y_max, width, height, has_rendered_arrows, uses_vector_arrows, has_triangular_arrows)

Draw arrow using Unicode directional characters for ASCII backend

Arguments

Type IntentOptional Attributes Name
character(len=1), intent(inout) :: canvas(:,:)
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
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
integer, intent(in) :: width
integer, intent(in) :: height
logical, intent(out) :: has_rendered_arrows
logical, intent(out) :: uses_vector_arrows
logical, intent(out) :: has_triangular_arrows

public subroutine render_ascii_legend_specialized(legend, canvas_context, legend_x, legend_y)

Render legend using ASCII-specific compact layout

Arguments

Type IntentOptional Attributes Name
type(legend_t), intent(in) :: legend
class(plot_context), intent(inout) :: canvas_context
real(kind=wp), intent(in) :: legend_x
real(kind=wp), intent(in) :: legend_y

public subroutine calculate_ascii_legend_dimensions(legend, width, legend_width, legend_height)

Calculate ASCII-specific legend dimensions

Arguments

Type IntentOptional Attributes Name
type(legend_t), intent(in) :: legend
integer, intent(in) :: width
real(kind=wp), intent(out) :: legend_width
real(kind=wp), intent(out) :: legend_height

public subroutine set_ascii_legend_border_width()

ASCII doesn't use line widths - no-op

Arguments

None

public subroutine calculate_ascii_legend_position(legend, width, height, x, y)

Calculate ASCII-specific legend position using character coordinates

Arguments

Type IntentOptional Attributes Name
type(legend_t), intent(in) :: legend
integer, intent(in) :: width
integer, intent(in) :: height
real(kind=wp), intent(out) :: x
real(kind=wp), intent(out) :: y

public subroutine extract_ascii_rgb_data(width, height, rgb_data)

Extract RGB data from ASCII backend (not supported - dummy data)

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: width
integer, intent(in) :: height
real(kind=real64), intent(out) :: rgb_data(width,height,3)

public subroutine get_ascii_png_data(width, height, png_data, status)

Get PNG data from ASCII backend (not supported)

Arguments

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

public subroutine prepare_ascii_3d_data(plots)

Prepare 3D data for ASCII backend (no-op - ASCII doesn't use 3D data)

Arguments

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

public subroutine render_ascii_ylabel(ylabel)

Render Y-axis label for ASCII backend (no-op - handled elsewhere)

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: ylabel

public subroutine draw_ascii_axes_and_labels(canvas, xscale, yscale, symlog_threshold, x_min, x_max, y_min, y_max, title, xlabel, ylabel, z_min, z_max, has_3d_plots, current_r, current_g, current_b, plot_width, plot_height, title_text, xlabel_text, ylabel_text, text_elements, num_text_elements)

Draw axes and labels for ASCII backend

Arguments

Type IntentOptional Attributes Name
character(len=1), intent(inout) :: canvas(:,:)
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
real(kind=wp), intent(in), optional :: z_min
real(kind=wp), intent(in), optional :: z_max
logical, intent(in) :: has_3d_plots
real(kind=wp), intent(in) :: current_r
real(kind=wp), intent(in) :: current_g
real(kind=wp), intent(in) :: current_b
integer, intent(in) :: plot_width
integer, intent(in) :: plot_height
character(len=:), intent(inout), allocatable :: title_text
character(len=:), intent(inout), allocatable :: xlabel_text
character(len=:), intent(inout), allocatable :: ylabel_text
type(text_element_t), intent(inout) :: text_elements(:)
integer, intent(inout) :: num_text_elements

public subroutine render_ascii_axes(title_text, xlabel_text, ylabel_text)

Render axes for ASCII context (stub implementation)

Arguments

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