Skip to content

Migrating to 1.30.0

H.P. Gansevoort edited this page Nov 27, 2026 · 1 revision

Migrating to 1.30.0

1.30.0 removes the public members that had a replacement, or no use left, so that each thing the library does is done in one place. This page says what to change in code written against 1.29.0. For what else changed, and why, read the changelog (its Removed list is the list on this page) and the Examples page, which shows each new call in code.

What to do

  1. Build again. Most verbs of the fluent builders (AxesBuilder and FigureBuilder) are now extension members of the same name. Every call you wrote compiles unchanged, but a program built against 1.29.0 has to be built again, because an extension member is a different call in the compiled code. The packages report this as a break of the binary only.
  2. Replace the removed calls named below. Each row says what takes its place.
  3. Check what a draw returns. A few results changed on purpose (the signal of a MACD, a slow stochastic, a spectrogram's numbers): the changelog's Changed and Fixed lists say which.

Y axes

Every Y axis stands in the container Axes.YAxes. Slot 0 of the left side is the primary axis, Add() stacks another axis on a side, and FirstOrAdd() takes the first axis of a side or makes it.

Removed Use
AxesBuilder.WithSecondaryYAxis(...) WithAddRightYAxis(...)
AxesBuilder.WithOutwardYAxis(side, ...) WithAddRightYAxis(...) or WithAddLeftYAxis(...)
SecondaryAxisBuilder, OutwardYAxisBuilder YAxisSlotBuilder
Axes.SecondaryYAxis, Axes.SecondarySeries Axes.YAxes.Right[0].Axis, Axes.YAxes.Right[0].Series
Axes.RightYAxes, Axes.LeftYAxes Axes.YAxes.Right, Axes.YAxes.Left
Axes.TwinX() Axes.YAxes.Right.FirstOrAdd()
Axes.AddOutwardYAxis(side) Axes.YAxes.Right.Add() or Axes.YAxes.Left.Add()
Axes.AddSecondarySeries(series) Axes.YAxes.Right.FirstOrAdd().AddSeries(series)
SecondaryAxisSlot YAxisSlot
Axes.PlotSecondary(x, y), Axes.ScatterSecondary(x, y) WithAddRightYAxis(right => right.Plot(x, y)), right.Scatter(x, y)
using MatPlotLibNet;

double[] hour = [0, 6, 12, 18, 24];
double[] requests = [120, 80, 300, 260, 140];
double[] cpu = [30, 22, 71, 64, 35];

var figure = Plt.Create()
    .AddSubPlot(1, 1, 1, ax => ax
        .Plot(hour, requests, s => s.Label = "Requests")
        .WithAddRightYAxis(right => right.Plot(hour, cpu, s => s.Label = "CPU (%)")))
    .Build();

Console.WriteLine(figure.SubPlots[0].YAxes.Right.Count);

You should see 1: one axis on the right, beside the primary one on the left.

Technical indicators from a data frame

MatPlotLibNet.DataFrame no longer has a call for each indicator: the 51 calls of DataFrameIndicatorExtensions, from df.Sma(...) to df.TransferEntropy(...), are removed. It reads the input of an indicator from the columns, and the indicator's own class does the rest, so its parameters, defaults and documentation stand in one place. One call reads each shape of bars (Hlc, Hlcv, Ohlc, Cv, Hl, Hlv) and Values reads one column.

using MatPlotLibNet;
using MatPlotLibNet.Indicators;
using Microsoft.Data.Analysis;

var df = new DataFrame(
    new PrimitiveDataFrameColumn<double>("high", [11.0, 12, 13, 12, 14, 15]),
    new PrimitiveDataFrameColumn<double>("low", [9.0, 10, 11, 10, 12, 13]),
    new PrimitiveDataFrameColumn<double>("close", [10.0, 11, 12, 11, 13, 14]));

double[] sma = new Sma(df.Values("close"), 3).Compute();
double[] atr = new Atr(df.Hlc("high", "low", "close"), 3).Compute();

Console.WriteLine($"{sma.Length} values of the average, {atr.Length} of the range");

You should see 4 values of the average, 3 of the range: an indicator gives a value from the bar its window is full.

Removed Use
df.AdxFull(...), the ADX with its +DI and -DI new Adx(df.Hlc("high", "low", "close")).ComputeFull()

Streaming indicators

Removed Use
The non-generic StreamingIndicator, with its protected ComputeNext, SetOutput and AppendToOutput StreamingIndicator<TInput>; a subclass writes its outputs in Step
DoubleRingBuffer RingBuffer<double>; its Min and Max are MinOrNaN() and MaxOrNaN()

StreamingSma, StreamingEma, StreamingRsi, StreamingBollinger and StreamingMacd are StreamingIndicator<double>. StreamingAtr, StreamingCci, StreamingStochastic, StreamingWilliamsR and StreamingObv are StreamingIndicator<OhlcvBar>, so a bar reaches them through IStreamingIndicator.Append. StreamingVwap is StreamingIndicator<TradedPrice>, a price with its volume (AppendWithVolume stays).

Animation, figures and templates

Removed Use
LegacyAnimationAdapter AnimationBuilder, which is an IAnimation<int> itself
FuncAnimation (MatPlotLibNet.Skia) AnimationBuilder with SaveGif, ToGif, SaveStepThroughSvg, ToStepThroughSvg and SaveFrames
FigureTemplates.SparklineDashboard((string Label, double[] Values)[], title) SparklineDashboard(IReadOnlyList<NamedSample>, title)
Figure.Legend Figure.Legends and AddLegend

Rendering

Removed Use
ColorBarRenderer.TickCount, ExtendFrac, ExtendMin, ExtendMax (protected) nothing: the bar's tick locator and its strip decide the ticks and the wedges
AxesRenderer.UpdateRange (protected) Range1D (Range1D.Empty, Merge, Normalized)
SvgRenderContext.DefineLinearGradient, DrawPathWithGradientFill a shape drawn with a ShapeStyle.Gradient
SvgRenderContext.OutputLength GetOutput()
DataRange3D Box3D
FigureTransform.Renderer (protected) FigureRenderer
GridSeries3D.ZToListList() (protected) nothing: the surface, the wireframe and the 3-D contour write their heights to JSON through the one conversion every grid-shaped series uses
IColormappable.GetColorMapOrDefault(fallback) source.ColorMap ?? fallback
SeriesRegistry.ResetForTests nothing public: it was a reset for test suites

Maps

Removed Use
GeoGeometry.Rings PositionRings
GeoClipping.SplitAtDateline(List<(double Lon, double Lat)>) SplitAtDateline(IReadOnlyList<GeoPosition>)

Interaction

Removed Use
ToolbarState InteractionToolbar.Buttons and ActiveToolId; nothing in the library made or took one
CrosshairState.SnappedPoint nothing: the library never set it
The figure parameter of the TrendlineDrawingModifier, LevelDrawingModifier and FibonacciDrawingModifier constructors, and the figure and toolbar parameters of the DrawingToolSelectionModifier constructor nothing: none of them read it
InteractionHost.InvalidateRequested the repaint given to the host when it is made: new InteractionHost(repaint)

MatPlotLibNet 1.31.0

On the docs site

Clone this wiki locally