Interactive
Two draggable points with a straight line between them.
ScottPlot.Plot myPlot = new();
for (int i = 0; i < 5; i++)
{
CoordinateLine line = Generate.RandomLine();
myPlot.Add.InteractiveLineSegment(line);
}
myPlot.SavePng("demo.png", 400, 300);
Horizontal line segments can be expanded horizontally by dragging the left and right edges, or slid vertically by dragging the center line.
ScottPlot.Plot myPlot = new();
for (int i = 1; i <= 5; i++)
{
double y = i;
double x1 = i;
double x2 = i * 2;
myPlot.Add.InteractiveHorizontalLineSegment(x1, x2, y);
}
myPlot.SavePng("demo.png", 400, 300);
Vertical line segments can be expanded vertically by dragging the top and bottom edges, or slid horizontally by dragging the center line.
ScottPlot.Plot myPlot = new();
for (int i = 1; i <= 5; i++)
{
double x = i;
double y1 = i;
double y2 = i * 2;
myPlot.Add.InteractiveVerticalLineSegment(x, y1, y2);
}
myPlot.SavePng("demo.png", 400, 300);
An interactive vertical line has an X position and extends to infinity along the Y axis.
ScottPlot.Plot myPlot = new();
for (int i = 0; i < 5; i++)
{
double x = Generate.RandomNumber();
myPlot.Add.InteractiveVerticalLine(x);
}
myPlot.SavePng("demo.png", 400, 300);
An interactive horizontal line has a Y position and extends to infinity along the X axis.
ScottPlot.Plot myPlot = new();
for (int i = 0; i < 5; i++)
{
double x = Generate.RandomNumber();
myPlot.Add.InteractiveHorizontalLine(x);
}
myPlot.SavePng("demo.png", 400, 300);
Interactive vertical and horizontal spans let the user select ranges along the vertical and horizontal axes, respectively.
ScottPlot.Plot myPlot = new();
myPlot.Add.InteractiveVerticalSpan(3, 5);
myPlot.Add.InteractiveHorizontalSpan(3, 5);
myPlot.Axes.SetLimits(0, 10, 0, 10);
myPlot.SavePng("demo.png", 400, 300);
Interactive markers respond to hover events and can be dragged.
ScottPlot.Plot myPlot = new();
for (int i = 0; i < 10; i++)
{
Coordinates point = Generate.RandomCoordinates();
var marker = myPlot.Add.InteractiveMarker(point);
marker.MarkerStyle.Shape = Generate.RandomMarkerShape();
}
myPlot.SavePng("demo.png", 400, 300);
Interactive rectangles can be resized by dragging their edges or repositioned by dragging their bodies
ScottPlot.Plot myPlot = new();
for (int i = 0; i < 5; i++)
{
CoordinateRect rect = Generate.RandomCoordinateRect();
myPlot.Add.InteractiveRectangle(rect);
}
myPlot.SavePng("demo.png", 400, 300);
Interactive trend lines extend infinitely in both directions and can be repositioned by dragging either control point.
ScottPlot.Plot myPlot = new();
CoordinateLine line = new(1, 2, 9, 7);
myPlot.Add.InteractiveTrendLine(line);
myPlot.Axes.SetLimits(0, 10, 0, 10);
myPlot.SavePng("demo.png", 400, 300);








