【发布时间】:2016-08-11 20:24:34
【问题描述】:
我想根据实时 x-y 坐标数据制作等高线图(使用 OxyPlot)。
我已经看到使用ContourSeries 给出的示例,但我无法理解如何实现轮廓。
示例代码如下:
namespace ExampleLibrary
{
using System;
using OxyPlot;
using OxyPlot.Axes;
using OxyPlot.Series;
[Examples("ContourSeries"), Tags("Series")]
public class ContourSeriesExamples
{
private static Func<double, double, double> peaks = (x, y) =>
3 * (1 - x) * (1 - x) * Math.Exp(-(x * x) - (y + 1) * (y + 1))
- 10 * (x / 5 - x * x * x - y * y * y * y * y) * Math.Exp(-x * x - y * y)
- 1.0 / 3 * Math.Exp(-(x + 1) * (x + 1) - y * y);
[Example("Peaks")]
public static PlotModel Peaks()
{
var model = new PlotModel { Title = "Peaks" };
var cs = new ContourSeries
{
ColumnCoordinates = ArrayBuilder.CreateVector(-3, 3, 0.05),
RowCoordinates = ArrayBuilder.CreateVector(-3.1, 3.1, 0.05)
};
cs.Data = ArrayBuilder.Evaluate(peaks, cs.ColumnCoordinates, cs.RowCoordinates);
model.Subtitle = cs.Data.GetLength(0) + "×" + cs.Data.GetLength(1);
model.Series.Add(cs);
return model;
}
}
我不明白的一些事情是“峰值”数学方程(它的目的是什么,它是如何得出的?) 我不明白的另一件事是轮廓本身是如何得出的。
【问题讨论】: