Triangular Axis
Create a triangular axis and add it to the plot to display data on a triangular grid, and interact with it to convert triangular units into Cartesian coordinates that can be used for placing any plot type on top.
ScottPlot.Plot myPlot = new();
// Add a triangular axis to the plot
var ta = myPlot.Add.TriangularAxis();
// Get points from various locations in triangular space
Coordinates[] points = [
ta.GetCoordinates(0.50, 0.40),
ta.GetCoordinates(0.60, 0.40),
ta.GetCoordinates(0.65, 0.50),
];
// Any plot type may be added on top of the triangular axis
myPlot.Add.Markers(points, MarkerShape.FilledCircle, 10, Colors.Red);
myPlot.SavePng("demo.png", 400, 300);
Triangular axes typically ascend in a clockwise direction for general applications, but triangular plots with counterclockwise labeling are sometimes used for geological applications.
ScottPlot.Plot myPlot = new();
// Add a COUNTER-CLOCKWISE triangular axis to the plot
var ta = myPlot.Add.TriangularAxis(clockwise: false);
// Get points from various locations in triangular space
Coordinates[] points = [
ta.GetCoordinates(0.50, 0.40),
ta.GetCoordinates(0.60, 0.40),
ta.GetCoordinates(0.65, 0.50),
];
// Any plot type may be added on top of the triangular axis
myPlot.Add.Markers(points, MarkerShape.FilledCircle, 10, Colors.Red);
myPlot.SavePng("demo.png", 400, 300);
Triangular axis background and grid lines may be customized.
ScottPlot.Plot myPlot = new();
var ta = myPlot.Add.TriangularAxis();
// Customize the background
ta.FillStyle.Color = Colors.Blue.WithAlpha(.1);
// Customize the grid lines
ta.GridLineStyle.Color = Colors.Black.WithAlpha(.5);
ta.GridLineStyle.Pattern = LinePattern.Dotted;
// Add sample data
Coordinates[] points = [
ta.GetCoordinates(0.50, 0.40),
ta.GetCoordinates(0.60, 0.40),
ta.GetCoordinates(0.65, 0.50),
];
myPlot.Add.Markers(points, MarkerShape.FilledCircle, 10, Colors.Red);
myPlot.SavePng("demo.png", 400, 300);
Styling options for edge lines, tick marks, tick labels, and title text may be customized individually for each axis.
ScottPlot.Plot myPlot = new();
var ta = myPlot.Add.TriangularAxis();
// the edge line extends from one corner to the other
ta.Left.EdgeLineStyle.Width = 3;
ta.Left.EdgeLineStyle.Color = Colors.Blue;
// tick labels and marks may be styled individually
ta.Left.TickLabelStyle.ForeColor = Colors.Blue;
ta.Left.TickMarkStyle.Color = Colors.Blue;
ta.Left.TickMarkStyle.Width = 3;
ta.Left.TickOffset = new(-10, 0);
ta.Left.TickLabelStyle.Bold = true;
ta.Left.TickLabelStyle.OffsetX = -4;
// an axis title may be added and styled
ta.Left.LabelText = "Hello, World";
ta.Left.LabelStyle.ForeColor = Colors.Blue;
ta.Left.LabelStyle.FontSize = 26;
ta.Left.LabelStyle.Bold = false;
ta.Left.LabelStyle.OffsetX = -20;
// Add sample data
Coordinates[] points = [
ta.GetCoordinates(0.50, 0.40),
ta.GetCoordinates(0.60, 0.40),
ta.GetCoordinates(0.65, 0.50),
];
myPlot.Add.Markers(points, MarkerShape.FilledCircle, 10, Colors.Red);
myPlot.SavePng("demo.png", 400, 300);
Triangular axis edges have a helper method to easily add a title and color all the edge components similarly.
ScottPlot.Plot myPlot = new();
var ta = myPlot.Add.TriangularAxis();
// Give each axis a title and color
ta.Bottom.Title("Methane", Colors.Red);
ta.Left.Title("Nitrogen", Colors.Green);
ta.Right.Title("Oxygen", Colors.Blue);
// Add sample data
Coordinates[] points = [
ta.GetCoordinates(0.50, 0.40),
ta.GetCoordinates(0.60, 0.40),
ta.GetCoordinates(0.65, 0.50),
];
myPlot.Add.Markers(points, MarkerShape.FilledCircle, 10, Colors.Red);
myPlot.SavePng("demo.png", 400, 300);




