Density Plot
Density Plots use KDE to estimate a PDF.
ScottPlot.Plot myPlot = new();
var ys = SampleData.Faithful;
var hist = Histogram.WithBinCount(80, ys);
var histPlot = myPlot.Add.Histogram(hist);
histPlot.BarWidthFraction = 0.8;
var densityEstimate = hist.Bins.Select((x, i) => KernelDensity.Estimate(x, ys)).ToArray();
double scale = ys.Length;
var rescaledDensityEstimate = densityEstimate.Select(x => x * scale).ToArray();
var scat = myPlot.Add.Scatter(hist.Bins, rescaledDensityEstimate, Colors.Red);
scat.MarkerSize = 0;
myPlot.SavePng("demo.png", 400, 300);
This recipe is one of many in the Kernel Density Estimation category
