Dark Mode
Plots can be created using dark mode by setting the colors of major plot components to ones consistent with a dark theme.
ScottPlot.Plot myPlot = new();
// set the color palette used when coloring new items added to the plot
myPlot.Add.Palette = new ScottPlot.Palettes.Penumbra();
// add things to the plot
for (int i = 0; i < 5; i++)
{
var sig = myPlot.Add.Signal(Generate.Sin(51, phase: -.05 * i));
sig.LineWidth = 3;
sig.LegendText = $"Line {i + 1}";
}
myPlot.XLabel("Horizontal Axis");
myPlot.YLabel("Vertical Axis");
myPlot.Title("ScottPlot 5 in Dark Mode");
myPlot.ShowLegend();
// change figure colors
myPlot.FigureBackground.Color = Color.FromHex("#181818");
myPlot.DataBackground.Color = Color.FromHex("#1f1f1f");
// change axis and grid colors
myPlot.Axes.Color(Color.FromHex("#d7d7d7"));
myPlot.Grid.MajorLineColor = Color.FromHex("#404040");
// change legend colors
myPlot.Legend.BackgroundColor = Color.FromHex("#404040");
myPlot.Legend.FontColor = Color.FromHex("#d7d7d7");
myPlot.Legend.OutlineColor = Color.FromHex("#d7d7d7");
myPlot.SavePng("demo.png", 400, 300);
This recipe is one of many in the Styling Plots category
