#5267·ScottPlot

Legend loses it's orientation when added as a panel

Author: aespitiaCreated Sep 10, 2026Updated Sep 10, 2026

Issue:

ScottPlot Version: 5.1.59

Code Sample:

cs
ScottPlot.Plot myPlot = new();

PieSlice slice1 = new() { Value = 5, FillColor = Colors.Red, Label = "alpha", LegendText = "alpha"  };
PieSlice slice2 = new() { Value = 2, FillColor = Colors.Orange, Label = "beta", LegendText = "beta" };
PieSlice slice3 = new() { Value = 8, FillColor = Colors.Gold, Label = "gamma", LegendText = "gamma" };
PieSlice slice4 = new() { Value = 4, FillColor = Colors.Green, Label = "delta", LegendText = "delta" };
PieSlice slice5 = new() { Value = 8, FillColor = Colors.Blue, Label = "epsilon", LegendText = "epsilon" };

List<PieSlice> slices = new() { slice1, slice2, slice3, slice4, slice5 };

myPlot.ShowLegend();
// setup the pie to display slice labels
var pie = myPlot.Add.Pie(slices);
pie.SliceLabelDistance = 1.3;


// hide unnecessary plot components
myPlot.Axes.Frameless();
myPlot.HideGrid();
myPlot.Legend.OutlineStyle = ScottPlot.LineStyle.None;
myPlot.Legend.ShadowColor = Colors.Transparent;
//if you change orientation before adding to panel, it loses it and defaults to horizontal
myPlot.Legend.Orientation = Orientation.Vertical;

ScottPlot.Panels.LegendPanel pan = new(myPlot.Legend);
pan.Alignment = Alignment.MiddleCenter;
pan.Edge = Edge.Bottom;
myPlot.ShowLegend(pan.Edge);

//if you change it after adding the legend panel, it's ok, but i don't know if there are other settings that get lost too
//myPlot.Legend.Orientation = Orientation.Vertical;


myPlot.SavePng("bug.png");

This shows horizontal legend, even though i defined vertical above Image