Multiplot Custom Layout
The Multiplot’s Layout property may be configured to achieve a fully custom layout.
ScottPlot.Multiplot multiplot = new();
// configure the multiplot to have 3 subplots
multiplot.AddPlots(3);
// add sample data to each subplot
for (int i = 0; i < multiplot.Subplots.Count; i++)
{
Plot plot = multiplot.GetPlot(i);
double[] ys = Generate.Sin(oscillations: i + 1);
plot.Add.Signal(ys);
}
// create a custom grid layout and define the position of each subplot
ScottPlot.MultiplotLayouts.CustomGrid gridLayout = new();
gridLayout.Set(multiplot.GetPlot(0), new GridCell(0, 0, 2, 1)); // double wide
gridLayout.Set(multiplot.GetPlot(1), new GridCell(1, 0, 2, 2)); // bottom left
gridLayout.Set(multiplot.GetPlot(2), new GridCell(1, 1, 2, 2)); // bottom right
// user the custom layout in our multiplot
multiplot.Layout = gridLayout;
multiplot.SavePng("demo.png", 400, 400);
This recipe is one of many in the Multiplot category
