ScottPlot多图

多图快速入门

使用 Multiplot 类创建具有多个子图的图形。

  

MultiplotRecipes.cs

ScottPlot.Multiplot multiplot = new();

// configure the multiplot to use 2 subplots
multiplot.AddPlots(2);
Plot plot1 = multiplot.Subplots.GetPlot(0);
Plot plot2 = multiplot.Subplots.GetPlot(1);

// add sample data to each subplot
plot1.Add.Signal(Generate.Sin());
plot2.Add.Signal(Generate.Cos());

WpfPlot1.Refresh();


多图列

Multiplot 的 Layout 属性可以自定义以实现列布局。

  

MultiplotRecipes.cs

ScottPlot.Multiplot multiplot = new();

// configure the multiplot to use 2 subplots
multiplot.AddPlots(2);
Plot plot1 = multiplot.Subplots.GetPlot(0);
Plot plot2 = multiplot.Subplots.GetPlot(1);

// add sample data to each subplot
plot1.Add.Signal(Generate.Sin());
plot2.Add.Signal(Generate.Cos());

// apply a custom layout
multiplot.Layout = new ScottPlot.MultiplotLayouts.Columns();

WpfPlot1.Refresh();


多图网格

Multiplot 的 Layout 属性可以自定义以实现网格布局。

  

MultiplotRecipes.cs

ConsoleWinFormsWPFOther

ScottPlot.Multiplot multiplot = new();

// configure the multiplot to have 6 subplots
multiplot.AddPlots(6);

// 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);
}

// configure the multiplot to use a grid layout
multiplot.Layout = new ScottPlot.MultiplotLayouts.Grid(rows: 2, columns: 3);

WpfPlot1.Refresh();


多图自定义布局

Multiplot 的 Layout 属性可以配置为实现完全自定义的布局。

  

MultiplotRecipes.cs

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;

WpfPlot1.Refresh();
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

code_shenbing

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值