MatPlotLibNet.DataFrame 1.17.1

dotnet add package MatPlotLibNet.DataFrame --version 1.17.1
                    
NuGet\Install-Package MatPlotLibNet.DataFrame -Version 1.17.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MatPlotLibNet.DataFrame" Version="1.17.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MatPlotLibNet.DataFrame" Version="1.17.1" />
                    
Directory.Packages.props
<PackageReference Include="MatPlotLibNet.DataFrame" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add MatPlotLibNet.DataFrame --version 1.17.1
                    
#r "nuget: MatPlotLibNet.DataFrame, 1.17.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package MatPlotLibNet.DataFrame@1.17.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=MatPlotLibNet.DataFrame&version=1.17.1
                    
Install as a Cake Addin
#tool nuget:?package=MatPlotLibNet.DataFrame&version=1.17.1
                    
Install as a Cake Tool

MatPlotLibNet.DataFrame

NuGet

Extension methods on Microsoft.Data.Analysis.DataFrame for MatPlotLibNet. Plot directly from a typed DataFrame, group the series by a hue column when you want to, and keep the full fluent API.

Install

dotnet add package MatPlotLibNet.DataFrame

Quick start

using MatPlotLibNet;                    // extension methods live in the top-level namespace
using Microsoft.Data.Analysis;

// Load from CSV or build in memory
var df = DataFrame.LoadCsv("prices.csv");

// Line chart — two numeric columns
df.Line("date", "close")
  .WithTitle("Closing Price")
  .Save("price.svg");

// Scatter with hue grouping — one series per ticker
df.Scatter("date", "close", hue: "ticker")
  .WithTitle("Portfolio")
  .Save("portfolio.svg");

// Histogram with hue grouping
df.Hist("returns", bins: 40, hue: "sector")
  .WithTitle("Return Distribution by Sector")
  .Save("returns.svg");

API

Charting — DataFrameFigureExtensions

// All three methods return FigureBuilder — chainable before .Build() / .ToSvg() / .Save()

FigureBuilder df.Line(string x, string y, string? hue = null, Color[]? palette = null)
FigureBuilder df.Scatter(string x, string y, string? hue = null, Color[]? palette = null)
FigureBuilder df.Hist(string column, int bins = 30, string? hue = null, Color[]? palette = null)

Financial Indicators — DataFrameIndicatorExtensions

Every indicator method reads the named column or columns into double[] and calls the core indicator types. Output arrays are trimmed, not NaN-padded. Their length is n - warmUp, where warmUp depends on the indicator period.

// Price indicators (single close/price column)
double[]      df.Sma(string priceCol, int period)
double[]      df.Ema(string priceCol, int period)
double[]      df.Rsi(string priceCol, int period = 14)
BandsResult   df.BollingerBands(string priceCol, int period = 20, double stdDev = 2.0)
double[]      df.Obv(string closeCol, string volumeCol)
MacdResult    df.Macd(string priceCol, int fast = 12, int slow = 26, int signal = 9)
double[]      df.DrawDown(string priceCol)

// Candle indicators (high / low / close columns)
double[]      df.Adx(string highCol, string lowCol, string closeCol, int period = 14)
AdxResult     df.AdxFull(string highCol, string lowCol, string closeCol, int period = 14)
double[]      df.Atr(string highCol, string lowCol, string closeCol, int period = 14)
double[]      df.Cci(string highCol, string lowCol, string closeCol, int period = 20)
double[]      df.WilliamsR(string highCol, string lowCol, string closeCol, int period = 14)
StochasticResult df.Stochastic(string highCol, string lowCol, string closeCol, int period = 14)
double[]      df.ParabolicSar(string highCol, string lowCol, double step = 0.02, double max = 0.2)
BandsResult   df.KeltnerChannels(string highCol, string lowCol, string closeCol, int period = 20, double atrMultiplier = 1.5)
double[]      df.Vwap(string highCol, string lowCol, string closeCol, string volumeCol)

Result types:

Type Properties
BandsResult Middle[], Upper[], Lower[]
MacdResult MacdLine[], SignalLine[], Histogram[]
AdxResult Adx[], PlusDi[], MinusDi[]
StochasticResult K[], D[]
// Example: candlestick + SMA + Bollinger Bands overlay
double[]    sma20 = df.Sma("close", 20);
BandsResult bb    = df.BollingerBands("close", period: 20, stdDev: 2.0);

string svg = Plt.Create()
    .AddSubPlot(1, 1, 1, ax =>
    {
        ax.UseBarSlotX()
          .Candlestick(open, high, low, close)
          .Signal(sma20, label: "SMA 20")
          .FillBetween(xVals, bb.Upper, bb.Lower, s => s.Alpha = 0.2);
    })
    .WithTitle("Price + Bollinger Bands")
    .ToSvg();

Polynomial Regression — DataFrameNumericsExtensions

// Fit a polynomial of the given degree to two numeric columns
double[] coeffs = df.PolyFit(string xCol, string yCol, int degree)

// Evaluate the fitted polynomial at every value in the X column
double[] fitY   = df.PolyEval(string xCol, double[] coefficients)

// Compute a confidence band for the fitted polynomial
ConfidenceBand band = df.ConfidenceBand(string xCol, string yCol,
                          double[] coefficients, double[] evalX, double level = 0.95)
// ConfidenceBand has Upper[] and Lower[]
// Example: scatter + linear fit + 95 % confidence band
double[] xVals  = DataFrameColumnReader.ToDoubleArray(df["x"]);
double[] yVals  = DataFrameColumnReader.ToDoubleArray(df["y"]);
double[] coeffs = df.PolyFit("x", "y", degree: 1);
double[] fitY   = df.PolyEval("x", coeffs);
ConfidenceBand band = df.ConfidenceBand("x", "y", coeffs, evalX: xVals);

string svg = Plt.Create()
    .AddSubPlot(1, 1, 1, ax =>
    {
        ax.Scatter(xVals, yVals, s => s.Label = "Data")
          .Plot(xVals, fitY, s => s.Label = "Linear fit")
          .FillBetween(xVals, band.Upper, band.Lower,
              s => { s.Alpha = 0.2; s.Label = "95 % CI"; });
    })
    .WithTitle("Regression with Confidence Band")
    .ToSvg();

If a column is not found, the call throws ArgumentException and reports the unknown column name.

Column type support

C# type ToDoubleArray ToStringArray
double identity .ToString()
float widening .ToString()
int / long / short / byte Convert.ToDouble .ToString()
decimal Convert.ToDouble .ToString()
DateTime DateTime.ToOADate() .ToString()
string not supported identity
null double.NaN ""

How it works

The extensions use DataFrameColumnReader to materialise the named DataFrame columns as double[] or string[]. They then hand all grouping, palette cycling, and series creation to the existing EnumerableFigureExtensions.Line / Scatter / Hist methods in the core package. No grouping code is duplicated. The DataFrame package is about 100 lines that only pass the data along.

Package Purpose
MatPlotLibNet Core charting library
MatPlotLibNet.Blazor Blazor component with interactive features
MatPlotLibNet.Notebooks Inline rendering in Polyglot Notebooks and Jupyter
MatPlotLibNet.Mcp MCP server that lets an AI agent render charts over stdio
MatPlotLibNet.AspNetCore ASP.NET Core middleware (/chart endpoints)
Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.17.1 90 9/13/2026
1.17.0 93 9/12/2026
1.16.0 86 9/12/2026
1.15.1 81 9/12/2026
1.15.0 84 9/11/2026
1.14.4 89 9/11/2026
1.14.3 102 8/30/2026
1.14.2 106 8/17/2026
1.14.1 111 8/15/2026
1.14.0 124 7/12/2026
1.13.0 123 7/4/2026
1.12.0 122 6/30/2026
1.11.2 117 5/16/2026
1.11.1 118 5/16/2026
1.10.0 112 5/4/2026
1.9.0 123 4/23/2026
1.8.0 115 4/22/2026
1.7.3 117 4/21/2026
1.7.2 117 4/18/2026
1.7.1 112 4/18/2026
Loading failed

MatPlotLibNet 1.17.1. What changed in this release, and in every release before it, is written out in the changelog: https://github.com/xkqg/MatPlotLibNet/blob/main/CHANGELOG.md#1171