箱形图快速入门
箱形图可以单独创建并添加到绘图中。
ScottPlot.Box box = new()
{
Position = 5,
BoxMin = 81,
BoxMax = 93,
WhiskerMin = 76,
WhiskerMax = 107,
BoxMiddle = 84,
};
WpfPlot1.Plot.Add.Box(box);
WpfPlot1.Plot.Axes.SetLimits(0, 10, 70, 110);
WpfPlot1.Refresh();
箱形图组
添加到绘图中的每个框集合的样式都相同,并在图例中显示为单个项目。添加具有已定义 X 位置的多个条形序列图,以提供分组数据的外观。
List<ScottPlot.Box> boxes1 = new() {
Generate.RandomBox(1),
Generate.RandomBox(2),
Generate.RandomBox(3),
};
List<ScottPlot.Box> boxes2 = new() {
Generate.RandomBox(5),
Generate.RandomBox(6),
Generate.RandomBox(7),
};
var bp1 = WpfPlot1.Plot.Add.Boxes(boxes1);
bp1.LegendText = "Group 1";
var bp2 = WpfPlot1.Plot.Add.Boxes(boxes2);
bp2.LegendText = "Group 2";
WpfPlot1.Plot.ShowLegend(Alignment.UpperRight);
WpfPlot1.Refresh();