public void ExecuteRecipe(Plot plt) { // create random data and display it with a scatter plot double[] xs = DataGen.Consecutive(50); double[] ys = DataGen.Random(new Random(0), 50); plt.AddScatter(xs, ys, label: "data"); // place the marker at the first data point var marker = plt.AddMarkerDraggable(xs[0], ys[0], MarkerShape.filledDiamond, 15, Color.Magenta); // constrain snapping to the array of data points marker.DragSnap = new ScottPlot.SnapLogic.Nearest2D(xs, ys); plt.Legend(); }