-
Notifications
You must be signed in to change notification settings - Fork 981
Closed
Labels
Help WantedScott won't do this soon, but PRs from the community are welcome!Scott won't do this soon, but PRs from the community are welcome!
Description
Hi, anyone have a working ScottPlot5 code example of Stacked Filled Line Plot? The syntax has changed, the the Scottplot 5 cookbook doesn't have this in there. I've partially got something working, however I've had to comment out the Tools.Pad lines, and don't know what to replace them with,
This is the link to the ScottPlot 4 code:
https://scottplot.net/cookbook/4.1/recipes/polygon_stackedfilledlineplot/
This is what I have so far:
// create sample data
double[] xsa = [1, 2, 3, 4];
double[] ys1 = [1, 3, 1, 2];
double[] ys2a = [3, 7, 3, 1];
double[] ys3 = [5, 2, 5, 6];
// manually stack plots
ys2a = Enumerable.Range(0, ys2a.Length).Select(x => ys2a[x] + ys1[x]).ToArray();
ys3 = Enumerable.Range(0, ys2a.Length).Select(x => ys3[x] + ys2a[x]).ToArray();
// pad data to turn a line into a shaded region
//xsa = Tools.Pad(xsa, cloneEdges: true);
//ys1 = Tools.Pad(ys1);
//ys2a = Tools.Pad(ys2a);
//ys3 = Tools.Pad(ys3);
// plot the padded data points as polygons
plot.Plot.Add.Polygon(xsa, ys3).LineWidth = 2;
plot.Plot.Add.Polygon(xsa, ys2a).LineWidth = 2;
plot.Plot.Add.Polygon(xsa, ys1).LineWidth = 2;This is the result:
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Help WantedScott won't do this soon, but PRs from the community are welcome!Scott won't do this soon, but PRs from the community are welcome!
