Skip to content

Scatter plot with fill doesn't clip line #3792

@BendRocks

Description

@BendRocks

Issue: (Describe the bug here)
When FillY is enabled with a scatter plot, the trace lines are not correctly clipped.

ScottPlot Version: (What NuGet package are you using?)

5.0.34.0

I cloned the repo and modified the Sandbox.Winforms.Form1.cs

Code Sample: See http://scottplot.net/faq/repro/ for tips about creating reproducible code samples

The following code was put into the Form1 constructor in the Sandbox.Winforms

  double[] xs = { 1, 10, 100, 1000, 10_000, 100_000 };
  double[] ys = { -50, -50, 10, -50, -80, -80 };

  // add log-scaled data to the plot
  ScottPlot.Plottables.Scatter sp = formsPlot1.Plot.Add.Scatter(xs, ys);
  sp.LineWidth = 5;
  sp.FillY = false;
  sp.FillYValue = -200;
 
  formsPlot1.Plot.Axes.Bottom.Min = 100;
  formsPlot1.Plot.Axes.Bottom.Max = 10000;

The output is as expected, with the trace clipped at the left and right edges of the plot:

image

If the same code is used, with sp.FillY set to true, we see the following output:

image

Notice above that the lines are no longer clipped at the left and right. Note the different shading of the fill is due to the bug #3791. That same block of code in scatter.cs code is likely the culprit since the lines render correctly when FillY is false.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Help WantedScott won't do this soon, but PRs from the community are welcome!⚠️ HIGH PRIORITY

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions