Repository navigation
Package Map
All packages target .NET 10 unless noted. The two core packages (MatPlotLibNet and MatPlotLibNet.Skia) also support .NET 8.
dotnet add package MatPlotLibNetEverything else depends on this package.
- Models:
Figure,Axes, all 83 series types - Fluent builder API:
Plt.Create(),FigureBuilder,AxesBuilder - Built-in SVG renderer (zero native dependencies)
- JSON serialization / deserialization (round-trip)
- Coordinate transforms, tick locators, tick formatters
- Themes, colormaps, rcParams, PropCycler
- Math text parser (
$\alpha$, superscripts, subscripts) - Constrained layout engine / tight layout
- Animation frame model (
AnimationBuilder) - Date axis:
AutoDateLocator,AutoDateFormatter
dnx MatPlotLibNet.McpA Model Context Protocol server. It is a .NET tool that an MCP host starts over
stdio, so an AI agent can render charts from a JSON spec. It has five tools: render_chart, save_chart,
chart_data_table (returns the chart's data as markdown), list_chart_types, and describe_chart_schema. It
targets .NET 10 only, because a .NET tool is resolved through the .NET 10 SDK. See MCP Server.
dotnet add package MatPlotLibNet.DataFrameExtension methods that resolve Microsoft.Data.Analysis.DataFrame column names and pass the columns to the charting, indicator, and regression APIs.
Charting (DataFrameFigureExtensions):
df.Line("date", "close", hue: "ticker")
df.Scatter("age", "income", hue: "segment")
df.Hist("returns", bins: 40, hue: "sector")Financial indicators (DataFrameIndicatorExtensions) — each method resolves the named columns to double[] and delegates to the core indicator types:
| Group | Methods |
|---|---|
| Price |
Sma, Ema, Rsi, BollingerBands, Obv, Macd, DrawDown
|
| Candle |
Adx, AdxFull, Atr, Cci, WilliamsR, Stochastic, ParabolicSar, KeltnerChannels, Vwap
|
Polynomial regression (DataFrameNumericsExtensions):
double[] coeffs = df.PolyFit("x", "y", degree: 1);
double[] fitY = df.PolyEval("x", coeffs);
ConfidenceBand band = df.ConfidenceBand("x", "y", coeffs, evalX: xVals);If a column name cannot be resolved, the method throws ArgumentException naming the column.
Full API reference: DataFrame package README.
dotnet add package MatPlotLibNet.SkiaRaster and vector export via SkiaSharp.
-
PngTransform— rendersFigureto PNG bytes -
PdfTransform— rendersFigureto PDF bytes -
GifEncoder— encodesAnimationBuilderframes to animated GIF (LZW, NETSCAPE2.0 loop) - Register at startup:
FigureExtensions.RegisterTransform(".png", new PngTransform());
FigureExtensions.RegisterTransform(".pdf", new PdfTransform());dotnet add package MatPlotLibNet.AvaloniaNative Avalonia 12 chart control backed by SkiaSharp.
-
MplChartControl : Control—FigureandIsInteractivestyled properties - Renders via
SkiaRenderContextthrough Avalonia'sISkiaSharpApiLeaseFeature -
IsInteractive = trueturns on the managed interaction layer (pan / zoom / reset / brush-select) - The control calls
InvalidateVisual()automatically after each mutation event - Targets .NET 10 and .NET 8; uses Avalonia 12 with the Skia backend (the default on all platforms)
<local:MplChartControl Figure="{Binding MyFigure}" IsInteractive="True" />| Gesture | Action |
|---|---|
| Left-drag | Pan |
| Scroll wheel | Zoom (cursor-centred) |
| Double-click | Reset |
| Home / Escape | Reset |
| Shift + left-drag | Brush-select |
Full examples: Avalonia package README.
dotnet add package MatPlotLibNet.UnoUno Platform (WinUI 3) chart element backed by SkiaSharp. It runs on Windows, Android, iOS, and macCatalyst from one codebase.
-
MplChartElement : SKCanvasElement—FigureandIsInteractivedependency properties -
RenderOverride(SKCanvas, Size)hands the canvas directly toSkiaRenderContext -
IsInteractive = trueturns on the same managed interaction layer as the Avalonia control - Targets
net10.0-windows10.0.19041.0,net10.0-android,net10.0-ios,net10.0-maccatalyst - Requires Uno.WinUI 5.2+ and SkiaSharp.Views.Uno.WinUI
<local:MplChartElement Figure="{x:Bind MyFigure, Mode=OneWay}" IsInteractive="True" />Full examples: Uno package README.
dotnet add package MatPlotLibNet.BlazorRazor component library for Blazor Server and Blazor WebAssembly.
-
<MplChart Figure="fig" />— static chart component -
<MplChart Figure="fig" ShowDataTable="true" />— the same chart, followed by its data table in a<details>disclosure. This works in every display mode and is off by default. See Accessibility -
<MplLiveChart ChartId="id" HubUrl="/charts-hub" />— live SignalR-driven component - Auto-updates when the publisher pushes a new figure
dotnet add package MatPlotLibNet.AspNetCoreServer-side infrastructure for serving charts, pushing them to clients, and receiving chart interactions.
-
IChartPublisher— push SVG/JSON to connected clients (group broadcast) -
ICallerPublisher(v1.2.2) — sends to one connection only; used for hover tooltip responses -
IChartRenderer— render figures on-demand - SignalR hub (
/charts-hub):- v1.2.0 mutation events:
OnZoom/OnPan/OnReset/OnLegendToggle -
v1.2.2 notification events:
OnBrushSelect(fire-and-forget) /OnHover(caller-only response)
- v1.2.0 mutation events:
-
FigureRegistry(v1.2.0, extended in v1.2.2) — per-chart pub/sub built on channels.Register(chartId, figure)starts a background reader task. The task drains interaction events, applies each one to the figure throughFigureInteractionEvent.ApplyTo, and republishes the figure viaIChartPublisher.PublishSvgAsync.-
Register(chartId, figure, configure)(v1.2.2) — an overload that attaches brush-select and hover handlers per chart viaChartSessionOptions.
-
-
ChartSessionOptions(v1.2.2) — a fluent set of handlers..OnBrushSelect(evt => ...)is fire-and-forget..OnHover(evt => ValueTask.FromResult<string?>(...))returns tooltip HTML to the originating client only. - REST endpoint:
GET /charts/{id}.svg - Endpoint mappings:
MapChartEndpoint(JSON),MapChartSvgEndpoint(SVG),MapChartTableEndpoint(the figure's data as an HTML table fragment — see Accessibility) - DI registration — registers
FigureRegistry,ICallerPublisher, andIChartPublisheras singletons:
builder.Services.AddMatPlotLibNetSignalR();Bidirectional interaction quick start (v1.2.2):
var figure = Plt.Create()
.Plot(xs, ys)
.WithServerInteraction("live-1", i => i.All()) // all six events: Zoom, Pan, Reset, LegendToggle, BrushSelect, Hover
.Build();
var registry = app.Services.GetRequiredService<FigureRegistry>();
registry.Register("live-1", figure, opts => opts
.OnBrushSelect(evt => {
Console.WriteLine($"Selected [{evt.X1}..{evt.X2}] × [{evt.Y1}..{evt.Y2}]");
return default;
})
.OnHover(async evt => $"<b>{await LookupValueAtAsync(evt.X, evt.Y):F2}</b>"));Full docs in Bidirectional SignalR.
dotnet add package MatPlotLibNet.InteractiveOpens the default browser with a self-hosted mini server. No external infrastructure needed.
var handle = await figure.ShowAsync();
await handle.UpdateAsync(); // push a new figure versionUse it for scripts, notebooks, and local tools.
dotnet add package MatPlotLibNet.GraphQLExposes charts via HotChocolate GraphQL.
- Query:
{ chartSvg(chartId: "sensor-1") }— the chart as SVG markup - Query:
{ chartDataTable(chartId: "sensor-1") }— the same chart's data as an HTML table (see Accessibility) - Query:
{ chartJson(chartId: "sensor-1") }— the figure spec - Subscription:
subscription { onChartSvgUpdated(chartId: "sensor-1") } - DI registration mirrors the AspNetCore package; it works alongside that package or standalone
dotnet add package MatPlotLibNet.MauiNative MAUI control rendered via Microsoft.Maui.Graphics.
-
MplChartView— drop into any MAUI layout - Set the
Figurebindable property to update the chart - No WebView; the graphics canvas renders the chart directly
Install from Verso's Extensions panel — search for MatPlotLibNet.Verso.
Charts inside a Verso notebook cell, the open-source notebook built to replace Polyglot. A cell that ends on a figure — or on the builder that makes one — draws the chart inline as SVG:
#r "nuget: MatPlotLibNet"
Plt.Create().WithTitle("Revenue").Plot([1, 2, 3, 4], [12, 18, 15, 22])The package references Verso.Abstractions and nothing else: a notebook loads an extension in its own load
context, so a charting assembly shipped alongside would be loaded twice and the extension's Figure would be a
different type from the cell's. It matches a chart by name and renders it through the assembly the value itself
came from. See Verso.
#r "nuget: MatPlotLibNet.Notebooks"Inline SVG rendering for Polyglot Notebooks (VS Code) and Jupyter.
⚠ Microsoft has ended Polyglot Notebooks and .NET Interactive, which this package builds on. Existing notebooks keep working, but the package is frozen at the version it reached and nothing builds or publishes it any more. For new notebook work see Verso, and the Notebooks page for the comparison.
Plt.Create().Plot(x, y).Display(); // renders inline in the notebook celldotnet add package MatPlotLibNet.WpfNative WPF chart control via SkiaSharp. MplChartControl : SKElement exposes Figure and IsInteractive dependency properties. It supports all 9 interaction modifiers: pan, zoom, 3D rotation, rectangle zoom, brush select, span select, legend toggle, crosshair, and hover. Targets net8.0-windows10.0.19041.0, because SkiaSharp.Views.WPF ships no WPF view for a lower Windows platform version. A project on a bare netX.0-windows fails to restore it (NU1202); write <TargetFramework>net8.0-windows10.0.19041.0</TargetFramework> (or the net9.0- / net10.0- equivalent) in your own project file.
dotnet add package MatPlotLibNet.GeoGeographic map projections and rendering. It ships 13 projections (PlateCarree, Mercator, Robinson, Orthographic, LambertConformal, Mollweide, Sinusoidal, AlbersEqualArea, AzimuthalEquidistant, Stereographic, TransverseMercator, NaturalEarth, EqualEarth). It embeds Natural Earth 110m coastlines (134 features), countries (177 features), and lakes. It also includes a GeoJSON parser, edge handling (dateline, NaN, clipping), and GeoPolygonSeries, a series that renders projected polygons itself.
Each of the three packages provides a TypeScript SignalR client that connects to MatPlotLibNet.AspNetCore and renders the SVG it receives.
| Package | Install | Framework |
|---|---|---|
@matplotlibnet/angular |
npm install @matplotlibnet/angular |
Angular 17+ |
@matplotlibnet/react |
npm install @matplotlibnet/react |
React 18+ |
@matplotlibnet/vue |
npm install @matplotlibnet/vue |
Vue 3 |
// React example
<MplLiveChart chartId="sensor-1" hubUrl="/charts-hub" />
// Angular example
<mpl-live-chart chartId="sensor-1" hubUrl="/charts-hub"></mpl-live-chart>
// Vue example
<MplLiveChart chart-id="sensor-1" hub-url="/charts-hub" />MatPlotLibNet 1.18.2