Skip to content

Notebooks

xkqg edited this page Apr 11, 2026 · 3 revisions

Notebooks

⚠ Deprecation notice: Microsoft has announced that Polyglot Notebooks (VS Code extension) reached end-of-life on March 27, 2026, and the .NET Interactive repository will be archived in April 2026. No further bug fixes or security patches will be issued.

MatPlotLibNet.Notebooks depends on Microsoft.DotNet.Interactive and targets this infrastructure. The package continues to work for existing setups but will not receive feature updates.


Recommended replacement — MatPlotLibNet.Interactive

If you used Polyglot Notebooks to explore data or iterate on charts, MatPlotLibNet.Interactive is the purpose-built replacement. It opens a live browser window directly from any .NET context — console app, script, test, background service — with no notebook runtime, no kernel, and no web server required.

dotnet add package MatPlotLibNet.Interactive
using MatPlotLibNet;
using MatPlotLibNet.Interactive;

double[] x = [1, 2, 3, 4, 5];
double[] y = [2, 4, 3, 5, 1];

// Opens a browser window — equivalent to a notebook cell output
var handle = await Plt.Create()
    .WithTitle("My Chart")
    .Plot(x, y)
    .Build()
    .ShowAsync();

// Recalculate and push a new frame — like re-running a cell
y = Recalculate();
await handle.UpdateAsync(Plt.Create().Plot(x, y).Build());

Why it's a better fit than a notebook:

Polyglot Notebooks MatPlotLibNet.Interactive
Runtime dependency .NET Interactive (EOL) None
Works in console / scripts No Yes
Works in unit tests No Yes
Live push updates No Yes (SignalR)
Requires VS Code extension Yes No
Survives kernel restart No Yes

See the Package Map#matplotlibnet-interactive for full details.


Existing Polyglot Notebooks setup

If you have existing notebooks that still run on Polyglot Notebooks, the package continues to work as before:

#r "nuget: MatPlotLibNet.Notebooks"
using MatPlotLibNet;

// Return a Figure — displayed inline automatically
Plt.Create().WithTitle("My Chart").Plot(x, y).Build()
// Explicit display — multiple charts in one cell
Plt.Create().Plot(x, y1).WithTitle("A").Build().Display();
Plt.Create().Plot(x, y2).WithTitle("B").Build().Display();

How it works

The package places its DLL in interactive-extensions/dotnet so Polyglot Notebooks auto-discovers it as a kernel extension. On load it registers a Formatter<Figure> with MIME type text/html:

Figure → figure.ToSvg() → <div style="overflow:auto;max-width:100%;">{svg}</div>

Other alternatives

VS Code Jupyter extension + standard .NET kernel

Microsoft's own migration guidance: use the VS Code Jupyter extension with an alternative Jupyter kernel. Save SVG to a file and reference it from a Markdown cell:

Plt.Create().Plot(x, y).Save("chart.svg");
// In a Markdown cell: ![chart](chart.svg)

Export SVG / PNG and open in browser

Simplest fallback for scripts — no runtime dependency at all:

Plt.Create().Plot(x, y).Save("chart.svg");  // open in any browser
Plt.Create().Plot(x, y).Save("chart.png");  // needs MatPlotLibNet.Skia

Package details

Target framework net8.0
Key dependency Microsoft.DotNet.Interactive (private, not transitive)
Status Maintenance only — no new features planned given upstream EOL
Replacement MatPlotLibNet.Interactive

Clone this wiki locally