-
Notifications
You must be signed in to change notification settings - Fork 3
Notebooks
⚠ Microsoft has ended Polyglot Notebooks and will archive .NET Interactive.
MatPlotLibNet.Notebooksbuilds on .NET Interactive. Existing setups keep working, but the package stands still at the version it reached and nothing builds or publishes it any more. For new notebook work see Verso.
MatPlotLibNet.Verso draws the same charts in a Verso notebook, the open-source notebook built to replace Polyglot. Install the extension from Verso's Extensions panel and a cell that ends on a figure shows the chart. See Verso for the whole page.
If what you want is a chart outside a notebook, MatPlotLibNet.Interactive opens a live browser window from any .NET context: a console app, a script, a test or a background service. It needs no notebook runtime, no kernel and no web server.
dotnet add package MatPlotLibNet.Interactiveusing 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());Which one to reach for:
| Polyglot Notebooks | Verso | MatPlotLibNet.Interactive | |
|---|---|---|---|
| Runtime dependency | .NET Interactive (EOL) | Verso | None |
| Charts inline in a cell | Yes | Yes | No |
| Works in console / scripts | No | No | Yes |
| Works in unit tests | No | No | Yes |
| Live push updates | No | No | Yes (SignalR) |
| Still developed | No | Yes | Yes |
See the Package Map for full details.
Existing Polyglot Notebooks setups keep working 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();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>
This is Microsoft's own migration guidance: use the VS Code Jupyter extension with an alternative Jupyter kernel. Save the SVG to a file and reference it from a Markdown cell:
Plt.Create().Plot(x, y).Save("chart.svg");
// In a Markdown cell: This is the simplest fallback for scripts. It has 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| Target framework | net8.0 |
| Key dependency |
Microsoft.DotNet.Interactive (private, not transitive) |
| Status | Frozen at the version it reached. Nothing builds it and nothing publishes it; the upstream runtime is EOL |
| Replacement |
MatPlotLibNet.Verso for a notebook, MatPlotLibNet.Interactive outside one |
MatPlotLibNet 1.18.0