Pure-Nim 2D surface and filled-contour plots for terminal applications.
Surface plots use Unicode half blocks to encode two samples per terminal row with independent foreground/background colors. Contour plots quantize the same matrix into value bands. No Python runtime or plotting backend is used.
Types
SurfacePlotOptions = object width*: int height*: int useColor*: bool showScale*: bool caption*: string palette*: seq[TerminalColor] minimum*: Option[float64] maximum*: Option[float64] contourLevels*: int lineEnding*: string
- Configuration shared by surface and filled-contour renderers.
Consts
SurfaceGlyphs: array[10, string] = [" ", "ยท", ":", "โ", "โ", "โ", "โ", "โ", "โ", "โ"]
- Low-to-high glyph ramp used for plain-text surfaces and contours.
Procs
proc clearSurfaceRange(options: var SurfacePlotOptions) {....raises: [], tags: [], forbids: [].}
- Restores automatic value scaling.
proc initSurfacePlotOptions(): SurfacePlotOptions {....raises: [], tags: [], forbids: [].}
- Returns defaults suitable for ANSI-capable terminals.
proc plot2D[T: SomeNumber](data: openArray[T]; columns: int; options = initSurfacePlotOptions()): string
- Compatibility-friendly alias for plotSurface with flat data.
proc plotContour[T: SomeNumber](data: openArray[seq[T]]): string
- Renders filled contours using default options.
proc plotContour[T: SomeNumber](data: openArray[seq[T]]; options: SurfacePlotOptions): string
- Renders a rectangular matrix as quantized filled contour bands.
proc plotContour[T: SomeNumber](data: openArray[T]; columns: int): string
- Renders flat row-major contours using default options.
proc plotContour[T: SomeNumber](data: openArray[T]; columns: int; options: SurfacePlotOptions): string
- Renders flat row-major data as filled contours.
proc plotSurface[T: SomeNumber](data: openArray[seq[T]]): string
- Renders a surface using default options.
proc plotSurface[T: SomeNumber](data: openArray[seq[T]]; options: SurfacePlotOptions): string
-
Renders a rectangular matrix as a high-resolution terminal surface.
Each terminal row contains two sampled matrix rows when Unicode half blocks and ANSI colors are enabled.
proc plotSurface[T: SomeNumber](data: openArray[T]; columns: int): string
- Renders flat row-major data using default options.
proc plotSurface[T: SomeNumber](data: openArray[T]; columns: int; options: SurfacePlotOptions): string
- Renders flat row-major data with the supplied number of columns.
proc setSurfaceRange(options: var SurfacePlotOptions; minimum, maximum: float64) {. ...raises: [ValueError], tags: [], forbids: [].}
- Sets a fixed color/contour scale.
Exports
-
replaceLinesSequence, graphLabelColor, graphAxisColor, clearLines, graphColorBelow, plot, graphXAxisTickCount, graphCaptionColor, DefaultLineCharSet, initAsciiGraphConfig, graphXAxisRange, plot, clearTerminal, AxisValueFormatter, graphSeriesLegends, AsciiGraphConfig, graphColorGradient, plotMany, synchronizedOutputSequence, axisOffset, upperBound, HeatmapSpectrum, labelPrecision, graphSeriesChars, graphWidth, lowerBound, graphSeriesColors, plotMany, LineCharSet, graphCaption, graphYAxisFormatter, graphHeight, LineGraphOption, graphColorAbove, clearLinesSequence, graphLineEnding, graphXAxisFormatter, createLineCharSet