Scatter List Quickstart
This experimental plot type has add/remove/clear methods like typical lists.
var plt = new ScottPlot.Plot(600, 400);
double[] xs = { 1, 2, 3, 4 };
double[] ys = { 1, 4, 9, 16 };
var scatterList = plt.AddScatterList();
scatterList.AddRange(xs, ys);
scatterList.Add(5, 25);
plt.SaveFig("scatterList_quickstart.png");
Scatter List Generic
This plot type supports generics.
var plt = new ScottPlot.Plot(600, 400);
int[] xs = { 1, 2, 3, 4 };
int[] ys = { 1, 4, 9, 16 };
var scatterList = plt.AddScatterList<int>();
scatterList.AddRange(xs, ys);
scatterList.Add(5, 25);
plt.SaveFig("scatterList_generic.png");
Scatter List Draggable
There exists an experimental Scatter Plot List with draggable points.
var plt = new ScottPlot.Plot(600, 400);
double[] xs = ScottPlot.DataGen.Consecutive(51);
double[] ys = ScottPlot.DataGen.Sin(51);
var scatter = new ScottPlot.Plottable.ScatterPlotListDraggable();
scatter.AddRange(xs, ys);
plt.Add(scatter);
plt.SaveFig("scatterList_draggable.png");
Scatter List Draggable Limits
A custom function can be used to limit the range of draggable points.
var plt = new ScottPlot.Plot(600, 400);
// plot sample data
double[] xs = ScottPlot.DataGen.Consecutive(20);
double[] ys = ScottPlot.DataGen.Sin(20);
var scatter = new ScottPlot.Plottable.ScatterPlotListDraggable();
scatter.AddRange(xs, ys);
scatter.MarkerSize = 5;
plt.Add(scatter);
// use a custom function to limit the movement of points
static Coordinate MoveBetweenAdjacent(List<double> xs, List<double> ys, int index, Coordinate requested)
{
int leftIndex = Math.Max(index - 1, 0);
int rightIndex = Math.Min(index + 1, xs.Count - 1);
double newX = requested.X;
newX = Math.Max(newX, xs[leftIndex]);
newX = Math.Min(newX, xs[rightIndex]);
return new Coordinate(newX, requested.Y);
}
scatter.MovePointFunc = MoveBetweenAdjacent;
plt.SaveFig("scatterList_draggableLimits.png");