Skip to content

SP5 Plot.GetPixel returns incorrect values when ScaleFactor is not 1.0 #3327

@MCF

Description

@MCF

As per the title, the input Coordinates for GetPixel are being scaled instead of the output Pixel object. This bug only occurs when Plot.ScaleFactor is changed from the default of 1.0. I am preparing a PR to fix this issue.

ScottPlot Version: 5.0.21

Code Sample:

    Plot plt = new();
    plt.Axes.SetLimits(1, 2, -15, -5);
    plt.ScaleFactor = 2.5F;     // Change from default of 1.0F
    plt.SaveTestImage();

    Pixel initialPx = new(329.0F, 200.0F);
    Coordinates coordinates = plt.GetCoordinates(initialPx);
    Pixel convertedPx = plt.GetPixel(coordinates);

    // Now initialPx != convertedPx (not even close)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions