## 曲线下填充

var plt = new ScottPlot.Plot(600, 400);

// create sample data
double[] xs = DataGen.Range(0, 10, .1, true);
double[] ys1 = DataGen.Sin(xs);
double[] ys2 = DataGen.Cos(xs);

// tighten the axis limits so we don't see lines on the edges
plt.SetAxisLimits(xMin: 0, xMax: 10);

plt.SaveFig("fill_curve.png");

## 填上填下

var plt = new ScottPlot.Plot(600, 400);

// create sample data
Random rand = new Random(3);
double[] xs = DataGen.Consecutive(201);
double[] ys = DataGen.RandomWalk(rand, xs.Length);

// tighten the axis limits so we don't see lines on the edges
plt.SetAxisLimits(xMin: 0, xMax: 200);

plt.SaveFig("fill_aboveBelow.png");

## 曲线间填充

var plt = new ScottPlot.Plot(600, 400);

// create sample data
double[] xs = DataGen.Range(0, 10, .1, true);
double[] ys1 = DataGen.Sin(xs);
double[] ys2 = DataGen.Cos(xs);

// add a polygon to fill the region between the two curves

// tighten the axis limits so we don't see lines on the edges
plt.SetAxisLimits(xMin: 0, xMax: 10);

plt.SaveFig("fill_between.png");

## 阴影填充

var plt = new ScottPlot.Plot(600, 400);

double SupplyFunction(double q) => 5 * q + 1;
double DemandFunction(double q) => -3 * q + 17;

const double priceFloor = 12.5;
double[] xs = DataGen.Consecutive(5);
double[] supply = xs.Select(SupplyFunction).ToArray();
double[] demand = xs.Select(DemandFunction).ToArray();

plt.AddScatter(xs, supply, markerShape: MarkerShape.none, label: "Supply");
plt.AddScatter(xs, demand, markerShape: MarkerShape.none, label: "Demand");

double[] maxProducerSurplusBounds = new double[] { 0, 1.5 };
var maxProducerSurplus = plt.AddFill(maxProducerSurplusBounds, maxProducerSurplusBounds.Select(SupplyFunction).ToArray(), maxProducerSurplusBounds, Enumerable.Repeat(priceFloor, 2).ToArray());
maxProducerSurplus.LineWidth = 0;
maxProducerSurplus.FillColor = Color.LawnGreen;
maxProducerSurplus.HatchColor = Color.Transparent;
maxProducerSurplus.HatchStyle = Drawing.HatchStyle.StripedWideDownwardDiagonal;
maxProducerSurplus.Label = "Maximum Possible Producer Surplus";

double[] minProducerSurplusBounds = new double[] { 1.2, 2.3 };
var minProducerSurplus = plt.AddFill(minProducerSurplusBounds, minProducerSurplusBounds.Select(SupplyFunction).ToArray(), minProducerSurplusBounds, Enumerable.Repeat(priceFloor, 2).ToArray());
minProducerSurplus.LineWidth = 0;
minProducerSurplus.FillColor = Color.Transparent;
minProducerSurplus.HatchColor = Color.Red;
minProducerSurplus.HatchStyle = Drawing.HatchStyle.StripedWideDownwardDiagonal;
minProducerSurplus.Label = "Minimum Possible Producer Surplus";

plt.Legend();

plt.SaveFig("fill_hatched.png");