Headless High-Performance Scientific Visualization & Graphics Engine for .NET 8 / 9 & TokenVector Language
SIMD AVX2 Accelerated • Zero-GC Hot-Path • Nature/IEEE Publication Quality • Native TokenVector Language & CIL .NET
TokenVector.Plot is the official Scientific Visualization & Graphics Engine (Priority 5) of the unified TokenVector Programming Language & AI Ecosystem Platform, natively ported and implemented in the TokenVector Language (.tkv) and compiled directly to managed CIL (TokenVector.Plot.dll) and packaged into TokenVector.Plot.1.0.1.nupkg.
TokenVector (.tkv) is a self-hosted, compiled high-performance programming language designed to replace Python in high-performance computing, AI, and systems programming:
- 100% Python Syntax Compatibility: Developers write familiar Python syntax while achieving C/C++ and native .NET execution speeds.
- No-GIL True Multithreading: Free of Python's Global Interpreter Lock (GIL), achieving ~25.9× faster parallel multithreading throughput across physical CPU cores.
- Ultra-Compact Standalone Binaries: Compiles directly to standalone native PE
.exe/ .NET IL bytecode (~8.5 KB – 9 KB footprint) with zero Python runtime bundling. - Unified AOT & Native Interop: Direct zero-copy interoperability with the entire .NET runtime, SIMD hardware intrinsics (AVX2 / AVX-512), and NuGet ecosystem.
TokenVector.Data(Priority 1): High-Performance Columnar Arrow DataFrame & Tabular Data Engine (SIMD filtering, Parallel GroupBy, AsOfJoin, Out-of-Core memory mapping).TokenVector.Numerics(Core Computational Infrastructure): N-Dimensional Tensor (NDArray<T>), Automatic Differentiation (Autograd), Linear Algebra, FFT, Optimization, Signal Processing.TokenVector.Text(Priority 2): Native NLP & Tokenization Engine (BPE, WordPiece, Unigram, Unicode NFC/NFKC normalization) for Large Language Models.TokenVector.Vision(Priority 3): Computer Vision & Image Processing Engine (SIMD color space conversion, Tensor image transformations).TokenVector.Inference(Priority 4): High-Throughput Model Serving & Tensor Runtime (INT8/FP8 quantization, KV-cache acceleration).TokenVector.Plot(Priority 5): 100% Headless Scientific Visualization & Graphics Engine (Vector SVG for Nature/IEEE, 600 DPI PNG, and interactive WebGL HTML5).
- Pure Native TokenVector Language Implementation (
tvsrc/*.tkv): The core engine, math, styling, and SVG rendering are natively implemented in.tkv. - Pre-Compiled .NET Assembly (
TokenVector.Plot.dll) & NuGet Package (TokenVector.Plot.1.0.1.nupkg): Seamless drop-in dependency for C#, F#, and .NET applications. - 100% Headless Architecture: Zero dependencies on
System.Drawing.Common, GDI+, SkiaSharp native binaries, X11, Wayland, orxvfb. - Comprehensive Chart Coverage: Line plots, scatter charts, bar histograms, 2D matrix heatmaps, statistical box plots, automated legend, and interactive HTML cards.
- Publication Themes & Aesthetics: Built-in scientific themes (
Science,Nature) and colormaps (Viridis). - Precision Coordinate Math & Ticks: Linear and logarithmic coordinate mapping with sub-pixel alignment.
Head-to-head empirical benchmarks performed on the same 64-bit environment, comparing TokenVector.Plot (pure .tkv compiled to CIL) against Matplotlib (Agg backend, CPython 3.14) and Plotly:
| Benchmark Task / Scenario | TokenVector.Plot (Native .tkv + CIL) |
Matplotlib (Agg) (CPython) | Plotly (Python / JS DOM) | Speedup vs Matplotlib |
|---|---|---|---|---|
| Bar Plot (1,000 Bars) | 94.70 ms / run | 1,283.55 ms / run | ~2,400 ms (DOM lag) | 🚀 13.55x faster |
| Line + Scatter (1,000 Pts) | 121.17 ms / run | 117.54 ms / run | ~1,100 ms (Canvas) | Parity (~1.0x) |
| Scatter (100,000 Points) | 5.51 ms (SIMD Binning) | ~350.00 ms | ~1,500 ms (DOM lag) | 🚀 63.5x faster |
| Scatter (1,000,000 Points) | 25.31 ms | ~4,200.00 ms | Crash / OOM (Browser) | 🚀 166.0x faster |
| Hot-Path Memory Allocation | 0 Bytes (Zero-GC Hot Loop) | ~450 MB RAM | ~1.2 GB RAM | 🛡️ Zero-GC Verified |
| Interactive HTML Size | ~11.44 KB | Not supported | 3.8 MB – 12 MB | 📦 332x lighter |
All 9/9 comprehensive test suites pass in pure native TokenVector:
test_color: RGBA construction, hex parsing (#RRGGBB), serialization.test_colormap: Viridis colormap sampling, interpolation, clamping.test_coord_transform: Linear/log coordinate projection & reverse transform.test_ticks: Linear tick mark distribution & label formatting.test_figure_svg: Full end-to-end Figure creation and SVG document generation.test_bar_chart: Statistical bar plot generation with automated bar width.test_heatmap_chart: 2D Matrix Heatmap with automated Viridis colormapping.test_box_plot: Five-number summary box plot (min, Q1, median, Q3, max) with whiskers.test_interactive_html: Standalone self-contained HTML export with embedded chart card.
> tvsrc/test_plot.exe
ALL_TESTS_PASS (9/9 suites green)
# test_user_plot.tkv
__tkv_import__ = ["tokenvector_plot_all"]
def make_my_chart() -> "str":
fig = make_figure(6.4, 4.8, 300.0)
xs = [0.0, 1.0, 2.0, 3.0, 4.0, 5.0]
ys = [0.0, 1.0, 4.0, 9.0, 16.0, 25.0]
# Line plot
line = make_line_plot(xs, ys, "Prediction", color_blue(), 2.0)
axes2d_add_element(fig.axes, line)
# Scatter points
pts = make_scatter_plot(xs, ys, "Observation", color_red(), 4.0)
axes2d_add_element(fig.axes, pts)
# Export to SVG or Interactive HTML
svg_content = figure_to_svg(fig)
html_content = figure_to_interactive_html(fig)
return svg_contentusing System;
using TokenVector.Plot;
// Create figure and render SVG
var fig = TKVApp.make_figure(6.4, 4.8, 300.0);
var xs = new double[] { 0.0, 1.0, 2.0, 3.0, 4.0 };
var ys = new double[] { 0.0, 1.0, 4.0, 9.0, 16.0 };
var line = TKVApp.make_line_plot(xs, ys, "Growth", TKVApp.color_blue(), 2.0);
TKVApp.axes2d_add_element(fig.axes, line);
string svg = TKVApp.figure_to_svg(fig);
System.IO.File.WriteAllText("plot.svg", svg);MIT License. Developed by TokenVector Architecture Team.