【问题标题】:OxyPlot Contour SeriesOxyPlot 等高线系列
【发布时间】: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;
    }
}

我不明白的一些事情是“峰值”数学方程(它的目的是什么,它是如何得出的?) 我不明白的另一件事是轮廓本身是如何得出的。

【问题讨论】:

    标签: c# winforms oxyplot


    【解决方案1】:

    要理解“峰”,你需要熟悉总代表Func&lt;T, TResult&gt;。在您的示例中,生成委托“peaks”有两个double 输入,一个输出结果也为double。输入假设为 x 和 y。 输出是 lambda "=>" 之后的函数。

    关于第二个问题;轮廓本身是如何得出的? 您可以将轮廓想象为在普通 XY 笛卡尔坐标上绘制的 3D 对象,在每个 x,y 处都有一个位于同一平面上的 z 值。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多