MatPlotLibNet 1.7.2
See the version list below for details.
dotnet add package MatPlotLibNet --version 1.7.2
NuGet\Install-Package MatPlotLibNet -Version 1.7.2
<PackageReference Include="MatPlotLibNet" Version="1.7.2" />
<PackageVersion Include="MatPlotLibNet" Version="1.7.2" />
<PackageReference Include="MatPlotLibNet" />
paket add MatPlotLibNet --version 1.7.2
#r "nuget: MatPlotLibNet, 1.7.2"
#:package MatPlotLibNet@1.7.2
#addin nuget:?package=MatPlotLibNet&version=1.7.2
#tool nuget:?package=MatPlotLibNet&version=1.7.2
MatPlotLibNet
A .NET 10 / .NET 8 charting library inspired by matplotlib. Fluent API, dependency injection, parallel SVG rendering, polymorphic export (SVG / PNG / PDF / GIF), and multi-platform output to Blazor, MAUI, Avalonia, Uno Platform, ASP.NET Core, Angular, React, and Vue.
๐งญ Stabilisation phase
After eleven feature releases (v1.0 โ v1.7.2) MatPlotLibNet now covers the practical 90% of matplotlib's surface: 74 series types, 13 map projections with embedded Natural Earth data, 26 themes, MathText with operator limits and matrices, streaming with O(1) indicators, native UI controls for Blazor / Avalonia / Uno / WPF / MAUI, fidelity tests against a pinned matplotlib reference, and 13 NuGet packages.
v1.7.1 started the stabilisation period; v1.7.2 continues it. The focus shifts from "ship more features" to:
- ๐ Bug fixes only (no new public API), driven by community use and the
โฅ90/90coverage gate - ๐งช Test coverage uplift (the eight-phase plan in
docs/COVERAGE.md) โ was 85.2% line / 68.4% branch at v1.7.0, now โ90.9% line / 76.5% branch with 153 classes still below absolute 90/90; strict-mode flip is the next milestone - ๐ Documentation polish โ cookbook examples, API XML doc completeness
- ๐ฑ Listening โ what should v2 be? Open a Discussion or Issue with what's missing for your use case. The next major direction will be guided by what real users need, not by a feature checklist.
No timeline for v1.8.0 yet โ when it ships, it will be community-driven.
v1.7.2 โ Browser-interaction subsystem hardened end-to-end (13-phase TDD plan + matplotlib-parity follow-on + full 4-layer interaction closure) + Phase L defect closure + Phase M marker-renderer + Phase N magic-string elimination + Phase O enum binary-compat hardening + bug fixes + coverage uplift + CI hardening. Continuation of the v1.7.1 stabilisation track. Now the stable release.
Phase O (v1.7.2 follow-on โ enum binary-compatibility hardening, 46 new tests):
- O.1 โ Explicit ordinals on every public enum. All 45 public enums now have
= Non every member. Source reordering can no longer shift a consumer's compiled IL.- O.2 โ
EnumOrdinalContractTestsCI gate. Pinned(name โ ordinal)snapshot for every public enum; Theory test fails on reorder/remove/renumber/rename. Discovery Fact detects any new public enum added without being registered.- O.3 โ Append-only contract documented in every enum's XML
<remarks>.- O.4 โ
JsonStringEnumConverterdefensively registered inChartSerializerso no integer ordinal leaks into persisted JSON even if a future DTO wires an enum-typed property directly.Phase N (v1.7.2 follow-on โ root-cause response to the Phase L/M bug-hunting loop, 19 new tests):
- N.1 โ Magic-string elimination (playground).
PlaygroundOptionshad four free-form string properties (ThemeName/LineStyle/MarkerStyle/ColorMap) with 25-/4-/8-case resolver switches;PlaygroundExamples._builderswas aDictionary<string, Func<โฆ>>keyed by free-form strings ("Line Chart", "Scatter Plot", โฆ). All replaced with typed properties (Theme,LineStyle,MarkerStyle,IColorMap) and a newPlaygroundExampleenum (16 values with[Description]for display names). Razor page binds typed enums and iteratesEnum.GetValues<T>(); a typo in the playground is now a compiler error, not a runtime silent fallback.- N.2 โ Enum contract tests (generic Theory harness). New
EnumOutputContract.EveryValueRendersDistinctOutput<TEnum>(...)asserts every rendering-driving enum value produces byte-distinct SVG output โ catches the Phase M.2 bug class ("advertised enum value silently collapsed to default") at CI time. Six high-risk enums covered:TickDirection,HistType,BoxStyle,ConnectionStyle,ArrowStyle,AxisScale. First-run hit surfaced 3 more renderer bugs โArrowStyle.CurveA/CurveBrender identical SVG,ArrowStyle.BracketA/BracketBrender identical SVG,AxisScale.Logitcollapses toLinear. Documented via[Fact(Skip = โฆ)]markers that un-skip when the renderer is fixed.Phase M (v1.7.2 follow-on โ 2 defects closed + 1 deeper bug surfaced, 21 new tests):
- M.1 โ Playground "Open in new tab" HTML wrap. Chart now fills the browser viewport AND pan/zoom/tooltips work in the new tab. Pre-fix bare SVG blob landed in a standalone-SVG context where
max-width:100%had no effect and embedded<script>elements didn't execute reliably.OpenInNewTabnow reuses the L.7SvgIframeWrapper.WrapForIframehelper; blob MIME flipped totext/html.- M.2 โ Shared
MarkerRendererfixes 11 silently-broken marker shapes.MarkerStylehas 13 members, but pre-fixLineSeriesRendererdrew every marker as a circle andScatterSeriesRendererhonoured only Square. New internalSrc/MatPlotLibNet/Rendering/MarkerRenderer.csdispatches all 13 shapes (Circle / Square / Triangle / TriangleDown / TriangleLeft / TriangleRight / Diamond / Cross / Plus / Star / Pentagon / Hexagon / None) overDrawCircle/DrawRectangle/DrawPolygon/DrawLineprimitives. Both renderers delegate via one call each (DRY). 19 Theory cases pin the SVG primitive per shape.Phase L (v1.7.2 follow-on โ 7 user-reported defects closed, 41 new tests):
- L.1 / L.2 โ Responsive SVG by default. SVG root now carries
style="max-width:100%;height:auto"so figures resize fluidly with their container whileviewBoxpreserves aspect. Pixelwidth/heightattributes stay on the element sonaturalWidth(client-side PNG export) still works. Opt out withFigureBuilder.WithResponsiveSvg(false).- L.5 โ Playground Width/Height sliders removed. Redundant with responsive default. Intrinsic aspect changed to 800ร450 (16:9 widescreen).
- L.6 โ Scatter Plot marker controls now work. Pre-fix
BuildScatterresolved the marker but never assigned it to the series.SupportsLineControlssplit from newSupportsMarkerControlsso Scatter hides the irrelevant line controls.- L.7 โ Playground
<iframe srcdoc>HTML wrap (interaction regression fix). Bare SVG insrcdoclanded in SVG-in-HTML parse context where inline scripts don't run. NewSvgIframeWrapper.WrapForIframewraps in a proper HTML document โ pan / zoom / tooltips / 3D rotate / treemap drilldown / sankey hover all work again in the preview iframe.- L.8 โ Tick label rotation. New
TickConfig.LabelRotation+AxesBuilder.WithXTickLabelRotation(double)/WithYTickLabelRotation(double). When no manual rotation is set and adjacent X labels would overlap, the renderer auto-rotates to 30ยฐ (matplotlibFigure.autofmt_xdateparity). Fixes the Candlestick playground's garbled X-axis.- L.9 โ Contour colormap routing + registry strict-mode.
AxesBuilder.WithColorMap(string)now throwsArgumentExceptionon unknown names (was silent no-op). PlaygroundBuildContoursetss.ColorMapdirectly inside the series lambda. All nine playground colormaps now produce distinct contour renderings.- L.11 โ
WithTightMargins()actually makes data touch the spines. Pre-fixRange1D.ExpandedToNiceBoundsIfAutostill widened the range to the next "nice" tick boundary even whenMargin == 0. Addedaxis.Margin == 0to the guard clause.
- Matplotlib-parity follow-on (Phases AโC + F + F.2โK): 3D drag now ROTATES the camera (was hijacked by 2D pan via
setPointerCapturelast-call-wins; fixed via 3D-scriptstopPropagation+ 2D-script bails on.mpl-3d-scene); full matplotlibProjection3Dported to JS for first-drag visual continuity (server vs. client agree to within 1 px at the playground's 20ร20 sinc +[-3, 3]ranges); drag math = matplotlib_on_move(dazim/delev = ยฑdx/wยท180); 2D wheel-zoom rate =0.85^step;x/ymodifier keys lock pan axis; Phase F three-tier subgroup structure (mpl-3d-back/mpl-3d-data/mpl-3d-front) isolates depth-sort from axis infrastructure. Phase F.2: tick-label + axis-title perpendicular-pad preservation under rotation (was collapsing onto axis edge). Phase F.3: 3D wheel-zoom now works for every chart, not just those with explicitdistance:โ server always emitsdata-distance=10and JS defaults match. Phase G: full browser SVG interaction closure โ 2D/3D keyboard, legend Enter/Space (WCAG 2.1.1), rich tooltips, selection brush + Esc, sliding treemap with themableTreemapTransitionMs, Sankey hover (Playground + static + Jint, previously zero coverage), SignalR invoke-mock harness, cursor visibility Theory, wiki Keyboard-Shortcuts page. Phase H: managedInteractionControllerโ RectangleZoom + SpanSelect state tests, CrosshairModifier wired up (was dead code), DataCursorModifier implemented (was orphaned toolbar button). Phase J: MplLiveChart subscription lifecycle + GraphQL subscription topic-bus integration. Phase K: measured interaction benchmarks โ 3D drag reproject 24 ms, 2D wheel 40 ยตs, Sankey hover 600 ยตs, harness cold-start 47 ms.- 2D scroll-wheel actually zooms now (was passive-listener silently scrolling page); 3D rotation moves the entire scene โ axes, grid, panes, ticks, labels โ not just data polygons; 3D scroll-wheel zoom + Home-key full reset; Pointer Events + pinch-to-zoom for touch parity; per-chart isolation (eight scripts that previously cross-talked between charts on one page now self-locate via
currentScript.parentNode).FigureBuilder.WithBrowserInteraction()now also enables 3D rotation, treemap drilldown, and sankey hover in addition to the 2D scripts.Theme Comparisoncookbook image now renders six actual themes via SkiaSharp grid composite (was six identical Default-theme renders).WithInteractionTheme(InteractionTheme theme)builder โ themable opacity / transition tokens; URL-hash state persistence (opt-in viadata-mpl-persist="true") โ refresh keeps zoom/pan; 3D lighting recomputation hooks under rotation; original-opacity preservation across hover cycles; treemap "Press Esc to zoom out" hint when drilled; tooltip focus position uses element bounds.- Behavioural test harness โ Jint-backed DOM stub replaces static-emission-only test pattern with real event simulation + DOM-mutation assertions across 42 new behavioural tests.
- 6-batch coverage uplift (Phases A-F) + Phase-9 dedup โ +1 192 tests, sub-90/90 class count 241 โ 154, 14 documented exemptions added for sample / interface / JS-template code.
- CI hardening โ Skia tests now ship
SkiaSharp.NativeAssets.{Linux.NoDependencies, Win32, macOS}solibSkiaSharp.soactually loads on Linux runners.5 385 tests green (3 known-bug skips) across 9 test projects covering 13 NuGet packages (was 5 776 pre-Phase P, 5 730 pre-Phase O, 5 714 pre-Phase N, 5 693 pre-Phase M, 5 594 pre-Phase L, 4 275 at v1.7.1, 3 967 in v1.7.0). Phase P consolidated the treemap and playground interaction tests โ fewer tests, each covering more of the collapse/expand + visually-distinct-themes surface area.
For earlier releases, see the full CHANGELOG.
Packages
| Package | Install | What it does |
|---|---|---|
| MatPlotLibNet | dotnet add package MatPlotLibNet |
Core: models, fluent API, SVG rendering, JSON, transforms |
| MatPlotLibNet.DataFrame | dotnet add package MatPlotLibNet.DataFrame |
Microsoft.Data.Analysis.DataFrame extension methods โ plot, indicators (SMA/EMA/RSI/MACD/โฆ), and polynomial regression from named columns |
| MatPlotLibNet.Skia | dotnet add package MatPlotLibNet.Skia |
PNG, PDF, and animated GIF export via SkiaSharp |
| MatPlotLibNet.Blazor | dotnet add package MatPlotLibNet.Blazor |
MplChart + MplLiveChart Razor components with SignalR |
| MatPlotLibNet.AspNetCore | dotnet add package MatPlotLibNet.AspNetCore |
REST endpoints, SignalR hub, IChartPublisher |
| MatPlotLibNet.Interactive | dotnet add package MatPlotLibNet.Interactive |
figure.ShowAsync() โ browser popup, no server needed |
| MatPlotLibNet.GraphQL | dotnet add package MatPlotLibNet.GraphQL |
GraphQL queries + subscriptions via HotChocolate |
| MatPlotLibNet.Maui | dotnet add package MatPlotLibNet.Maui |
Native MplChartView via Microsoft.Maui.Graphics |
| MatPlotLibNet.Avalonia | dotnet add package MatPlotLibNet.Avalonia |
Native MplChartControl for Avalonia 12 โ Skia backend, optional local interaction |
| MatPlotLibNet.Uno | dotnet add package MatPlotLibNet.Uno |
Native MplChartElement for Uno Platform (WinUI 3 / Android / iOS / macCatalyst) |
| MatPlotLibNet.Wpf | dotnet add package MatPlotLibNet.Wpf |
Native WPF MplChartControl via SkiaSharp โ all 9 interaction modifiers |
| MatPlotLibNet.Geo | dotnet add package MatPlotLibNet.Geo |
13 map projections, GeoJSON parser, Natural Earth 110m data, geographic polygons |
| MatPlotLibNet.Notebooks | #r "nuget: MatPlotLibNet.Notebooks" |
Inline SVG in Polyglot / Jupyter notebooks |
| @matplotlibnet/angular | npm install @matplotlibnet/angular |
Angular components + TypeScript SignalR client |
| @matplotlibnet/react | npm install @matplotlibnet/react |
React hooks + components + TypeScript SignalR client |
| @matplotlibnet/vue | npm install @matplotlibnet/vue |
Vue 3 composables + TypeScript SignalR client |
Documentation
Full documentation is on the GitHub Wiki, the Cookbook (runnable examples with rendered images), and the API Reference (generated from XML doc comments):
- Playground โ try charts live in the browser โ pick an example, tweak parameters, see the SVG update instantly
- Cookbook โ copy-paste code examples with rendered output for every chart type
- API Reference โ full API documentation from source
- Getting Started โ installation, output formats, subplots
- Fluent Cheatsheet โ one-page reference for
Plt/FigureBuilder/AxesBuilder - Package Map โ all 13 NuGet + 3 npm packages in detail
- Chart Types โ all 74 series with code examples
- Streaming & Realtime โ ring buffers, StreamingFigure, axis scaling, 11 streaming indicators, platform controls
- Interactive Controls โ Avalonia + Uno native controls, managed interaction layer
- Bidirectional SignalR โ server-authoritative interactive charts, event hierarchy, hub wiring
- DataFrame โ indicators, polynomial regression from
Microsoft.Data.Analysis.DataFrame - Notebooks โ Polyglot Notebooks + Jupyter inline rendering
- Styling โ themes, colormaps, PropCycler
- Accessibility โ SVG semantics, keyboard navigation, color-blind palette
- Advanced โ date axes, math text, animations, GIF, real-time
- Benchmarks โ SVG rendering, SIMD transforms, indicators
- Roadmap โ version history and planned phases
- Contributing โ build, test, coding conventions
Quick start
using MatPlotLibNet;
using MatPlotLibNet.Styling;
double[] x = [1, 2, 3, 4, 5];
double[] y = [2, 4, 3, 5, 1];
Plt.Create()
.WithTitle("My First Chart")
.WithTheme(Theme.Dark)
.Plot(x, y, s => { s.Color = Color.Blue; s.Label = "Data"; })
.WithLegend()
.Save("chart.svg");
Features
74 series types โ line, scatter, bar, histogram, pie, box, violin, heatmap, contour, candlestick, OHLC, treemap, sunburst, Sankey, polar, polar heatmap, 3D surface, Bar3D, PlanarBar3D, Line3D, Trisurf3D, Contour3D, Quiver3D, Voxels, Text3D, radar, waterfall, funnel, gauge, streaming line/scatter/signal/candlestick, and more.
Native UI controls โ MplChartControl for Avalonia 12 and MplChartElement for Uno Platform render charts natively via SkiaSharp โ no browser, no WebView, no SignalR required. 9 interaction modifiers: pan (drag), zoom (scroll), 3D rotation (right-drag), rectangle zoom (Ctrl+drag), brush select (Shift+drag), span select (Alt+drag), legend toggle (click), crosshair (passive), hover tooltip. Toolbar state model, view history (back/forward), data cursor (click-to-pin), tick mirroring, tight margins.
MathText โ LaTeX-like inline math in any label or title: $\alpha^{2}$, $\frac{a}{b}$, $\sqrt{x}$, $\hat{x}$, $\mathbf{F}$, $\mathbb{R}$. 96 symbol mappings (Greek, math operators, arrows, relations, set/logic, blackboard bold), fractions, square roots, accents, font variants, spacing, and scaling delimiters.
3-D charts โ 12 series types: Surface, Scatter3D, Bar3D, PlanarBar3D, Line3D, Trisurf3D (Delaunay), Contour3D (marching squares), Quiver3D (vector field), Voxels (face-culled cubes), Text3D (annotations). Full Projection3D pipeline, DepthQueue3D painter's algorithm, LightingHelper shading, Svg3DRotationScript client-side rotation with depth re-sorting, configurable Pane3DConfig (floor/wall colors), and 3D colorbar support.
Streaming & Realtime โ StreamingLineSeries, StreamingScatterSeries, StreamingSignalSeries, StreamingCandlestickSeries backed by DoubleRingBuffer with AppendPoint(x, y). StreamingFigure provides throttled re-rendering and auto-scaling axes (SlidingWindow, StickyRight, AutoScale). 11 streaming indicators (SMA, EMA, RSI, Bollinger, MACD, OBV, ATR, Stochastic, WilliamsR, CCI, VWAP) auto-attach to candlestick data. Streaming controls for Avalonia, Uno, MAUI, Blazor, and ASP.NET Core. SVG diff engine for bandwidth optimization. Rx IObservable<T> adapter.
Geographic projections โ MatPlotLibNet.Geo package with 5 map projections (PlateCarree, Mercator, Robinson, Orthographic, LambertConformal), GeoJSON parser, Natural Earth 110m embedded data, and GeoPolygonSeries for coastlines/borders/choropleth. Symlog axis scale for data spanning positive and negative ranges.
Bidirectional SignalR โ server-authoritative interactive charts with mutation events (zoom, pan, reset, legend toggle) and notification events (brush-select, hover). Stacked-record event hierarchy, natural coalescing, per-caller hover responses.
104 colormaps โ viridis, plasma, turbo, coolwarm, and 100 more. NumPy-style SIMD numerics (Vec, Mat, Linalg, Fft). Accessibility (ARIA, keyboard, Okabe-Ito palette, high-contrast theme). Matplotlib look-alike themes. DataFrame integration with 16 financial indicators. Broken axes. Publication-quality SVG/PNG/PDF/GIF export.
License
MIT โ free for any use, open-source or commercial, with no copyleft conditions.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- System.Numerics.Tensors (>= 10.0.6)
-
net8.0
- System.Numerics.Tensors (>= 10.0.6)
NuGet packages (7)
Showing the top 5 NuGet packages that depend on MatPlotLibNet:
| Package | Downloads |
|---|---|
|
MatPlotLibNet.AspNetCore
ASP.NET Core endpoint helpers for MatPlotLibNet. Serves chart JSON specs for Angular and other SPA frameworks. |
|
|
MatPlotLibNet.Skia
PNG and PDF export for MatPlotLibNet charts using SkiaSharp. |
|
|
MatPlotLibNet.Blazor
Blazor components for MatPlotLibNet charting library. Renders charts as inline SVG. |
|
|
MatPlotLibNet.Maui
MAUI controls for MatPlotLibNet charting library. Renders charts via Microsoft.Maui.Graphics. |
|
|
MatPlotLibNet.Notebooks
Polyglot Notebooks / Jupyter support for MatPlotLibNet. Renders Figure inline as SVG in notebook cells. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.10.0 | 238 | 5/4/2026 |
| 1.9.0 | 239 | 4/23/2026 |
| 1.8.0 | 242 | 4/22/2026 |
| 1.7.3 | 233 | 4/21/2026 |
| 1.7.2 | 241 | 4/18/2026 |
| 1.7.1 | 218 | 4/18/2026 |
| 1.7.0 | 226 | 4/17/2026 |
| 1.6.0 | 220 | 4/17/2026 |
| 1.5.0 | 222 | 4/17/2026 |
| 1.4.1 | 214 | 4/17/2026 |
| 1.4.0 | 199 | 4/17/2026 |
| 1.3.0 | 218 | 4/16/2026 |
| 1.2.2 | 205 | 4/15/2026 |
| 1.2.1 | 204 | 4/15/2026 |
| 1.2.0 | 209 | 4/15/2026 |
| 1.1.4 | 202 | 4/15/2026 |
| 1.1.3 | 221 | 4/13/2026 |
| 1.1.1 | 220 | 4/12/2026 |
| 1.1.0 | 202 | 4/12/2026 |
| 1.0.2 | 206 | 4/12/2026 |