Skip to content
xkqg edited this page Apr 15, 2026 · 96 revisions

MatPlotLibNet Wiki

Matplotlib-inspired charting for .NET — SVG/PNG/PDF output, 61 series types, fluent API, and first-class support for Blazor, MAUI, ASP.NET Core, and JS frameworks.

Current version: 1.1.4 · NuGet · Changelog · License: MIT

v1.1.4 — wrap-up quality release. No new shipping minor version to chase; instead a dedicated pass of polish, consolidation, and bug-fixing across the whole rendering / layout / fluent-API surface. Every Sankey renders correctly at multi-column cascades, every fidelity test is pixel-verified against matplotlib 3.10.8 (146/146, up from 144/146), every unit test is green (3353/3353, up from 3328/3329), and every documented feature has at least one sample and one dedicated test. Also removes the half-baked Geo/Map stub so the library only ships what it actually does well. Highlights:

  • Sankey overhaul — explicit-column cascades, iterative vertical relaxation (minimises crossings), SVG <linearGradient> source→target link blends, sub-labels (e.g. "$13.9B +2%" in green/red), inside-labels, vertical orientation (top→bottom flow), and a new hover emphasis script that dims every link not reachable from the hovered node (ECharts focus: adjacency). Five new samples from 2-column baselines through 5-column process cascades and alluvial customer-journey diagrams.
  • Interactive treemap drilldown — click a rect to zoom into its subtree; keyboard-navigable; Escape to unwind. FigureBuilder.WithTreemapDrilldown().
  • Nested pie — AxesBuilder.NestedPie(root) wrapper: a two-level TreeNode renders as an inner pie + outer breakdown ring.
  • Label collision avoidance — new LabelLayoutEngine resolves overlap between data labels on dense pies, sunbursts, Sankeys, and bar charts with iterative MTV repulsion + optional leader lines.
  • Outside legend positions — four new LegendPosition.Outside* values. Constrained layout reserves margin for the legend box via the new shared LegendMeasurer.
  • PlanarBar3DSeries — matplotlib's "2-D bars in different planes" skyscraper plot with full per-bar colour API, cross-series DepthQueue3D for correct compositing, and matplotlib-exact face shading via LightingHelper.ShadeColor.
  • SVG/PNG byte-identical layout — new IFontMetrics + IGlyphPathProvider abstractions so both backends share Skia's glyph metrics. SVG now emits text as <path> (matches matplotlib's svg.fonttype='path').
  • Geo/Map subsystem removed — the earlier implementation only rendered coloured rectangles without coastlines or interrupted projections; shipping it misrepresented capability. Real geographic support is deferred to a later milestone and will be designed from scratch.
  • Bug fixes — Projection3D finally honours its distance: argument (was silently ignored); Stem3DSeries draws the matplotlib ax.stem() baseline polyline; EventplotSeries tick-line extent + auto-range; AutoLocator.ExpandToNiceBounds wired into CartesianAxesRenderer. 146/146 fidelity tests + 3353/3353 unit tests all green (was 144/146 + 3328/3329 before v1.1.4).

v1.1.3 — Dual-theme matplotlib fidelity sweep: every chart now has 146 pixel-verified fidelity tests running against pinned matplotlib 3.10.8 references under both Theme.MatplotlibClassic and Theme.MatplotlibV2. Three latent multi-subplot rendering bugs fixed (legend mathtext, interior y-label gutter, dynamic suptitle height) plus three pre-existing rendering bugs caught by pixel-by-pixel inspection (swapped y-tick mark coordinates, missing Skia text rotation, wrong layout reservation for rotated y-labels).


Who Should Use This?

MatPlotLibNet is built for .NET developers who need charting that fits naturally into their existing stack — no JavaScript framework, no third-party SaaS, no extra runtime.

You are… MatPlotLibNet gives you…
Blazor / ASP.NET Core developer Drop-in <MplChart> and <MplLiveChart> components; SignalR push; REST endpoint — all wired with standard DI
MAUI developer Native MplChartView control via Microsoft.Maui.Graphics — no WebView
Data scientist / analyst Inline SVG in Polyglot Notebooks or Jupyter; 62 series types; MatPlotLibNet.DataFrame for plotting, 16 financial indicators, and polynomial regression directly from Microsoft.Data.Analysis.DataFrame column names
Financial / trading app developer Candlestick, OHLC, 13 technical indicators (SMA, EMA, RSI, MACD, Bollinger, Stochastic, …), backtesting panels
Full-stack .NET + JS developer TypeScript clients for Angular, React, and Vue — same SignalR hub, same chart definitions
Backend / headless pipeline Render SVG, PNG, PDF, or animated GIF server-side with zero UI dependencies

Why MatPlotLibNet?

vs. ScottPlot / OxyPlot / LiveCharts2

These are excellent WinForms / WPF / MAUI renderers. MatPlotLibNet targets the web and server first: SVG rendered on the server, pushed to any browser client over SignalR. No canvas, no WebAssembly boot cost, no browser rendering differences.

vs. Plotly.NET

Plotly.NET emits JavaScript that runs in the browser. MatPlotLibNet renders entirely in .NET — the browser receives finished SVG. That means no JS dependency, consistent output, inline SVG in the DOM (CSS-styleable, accessible, print-quality), and rendering that scales with your server hardware.

vs. SciChart / Syncfusion

Commercial libraries with per-developer or per-app licensing. MatPlotLibNet is MIT — free for any use, open-source or commercial, with no copyleft conditions.

Key differentiators at a glance

MatPlotLibNet
Rendering Server-side SVG — zero client cost
Output SVG, PNG, PDF, JSON, animated GIF
Real-time SignalR push to Blazor, Angular, React, Vue
Series types 61 — including 3D, polar, financial, hierarchical, Sankey
Math text LaTeX-like inline math in any label or title
Performance AVX SIMD coordinate transform, parallel subplot rendering
License MIT — no copyleft, free for any use
Dependencies Zero for SVG; SkiaSharp opt-in for PNG/PDF/GIF

Quick Start

dotnet add package MatPlotLibNet
Plt.Create()
   .WithTitle("Hello MatPlotLibNet")
   .Plot(x, y, s => { s.Color = Color.Blue; s.Label = "Data"; })
   .WithLegend()
   .Save("chart.svg");

MatPlotLibNet dashboard


Wiki Pages

Page Contents
Getting Started Installation, quick start, output formats (SVG/PNG/PDF/JSON/GIF)
Fluent Cheatsheet One-page reference for Plt / FigureBuilder / AxesBuilder — ships with v1.1.4
Package Map All 9 NuGet packages + 3 JS packages explained
Notebooks Polyglot Notebooks + Jupyter — inline SVG, Display(), tips
Chart Types All 61 series types with code examples
Styling Themes, colors, colormaps, rcParams, PropCycler
Advanced Layouts, date axes, math text, animations, real-time charts
Benchmarks SVG rendering, SIMD transforms, indicators, JSON, PNG/PDF
Roadmap Version history; v1.1.4 complete
Contributing How to build, test, and contribute

At a Glance

Series types 61 — line, scatter, bar, financial, statistical, 3D, polar, hierarchical, Sankey, vector
Output formats SVG (built-in), PNG, PDF, JSON, animated GIF
Platforms .NET 10 / .NET 8, Blazor, MAUI, ASP.NET Core, Angular, React, Vue, Jupyter
Real-time SignalR push to any connected client
Math text LaTeX-like inline math: $\alpha$, x^{2}, H_{2}O
Date axes Auto tick selection from years down to seconds
Layout Constrained layout engine — auto-computes margins from text extents
Transform AVX SIMD single-pass coordinate transform — up to 11.8× faster than naive
Tests 3,353 unit tests + 146 dual-theme matplotlib fidelity tests (73 fixtures × MatplotlibClassic + MatplotlibV2) — every chart pixel-verified against matplotlib 3.10.8

Clone this wiki locally