Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Heatmap: Left edge does not start at zero #3806

Closed
swharden opened this issue May 8, 2024 · 5 comments
Closed

Heatmap: Left edge does not start at zero #3806

swharden opened this issue May 8, 2024 · 5 comments

Comments

@swharden
Copy link
Member

swharden commented May 8, 2024

Email from Feng Q.

It’s a bug?The coordinate system range was set, but the drawing exceeded the range of the coordinate system. You developed this control is very practical, very good, thank you very much!

image

@swharden
Copy link
Member Author

swharden commented May 8, 2024

Seems to be https://scottplot.net/cookbook/5.0/Heatmap/HeatmapInverted/ which I think is functioning as expected

@swharden swharden closed this as completed May 8, 2024
@FengQingYangDad
Copy link

Thank you very much for your reply. Both X and Y coordinates are set in this coordinate system, the X coordinates are from 0 to 65, but the actual graph shows that the X-axis appears to start at -0.5. The same XY coordinate system has the phenomenon of outside the set range。

@swharden
Copy link
Member Author

swharden commented May 8, 2024

Thanks for the clarification @FengQingYangDad! I'll open this issue back up and we can take a closer look shortly and hopefully arrive at a good solution for the next release 👍

@swharden swharden reopened this May 8, 2024
@swharden swharden changed the title Heatmap: is there a scale issue? Heatmap: Left edge does not start at zero May 8, 2024
@FengQingYangDad
Copy link

thank you very much!

@swharden
Copy link
Member Author

Default behavior is that the lower left cell is centered at (0, 0) resulting in the behavior you observe:

double[,] data = {
    { 1, 2, 3 },
    { 4, 5, 6 },
    { 7, 8, 9 },
};

myPlot.Add.Heatmap(data);

HeatmapCellAlignment

Set cell alignment to lower left for the bottom left corner of the heatmap to be at the origin:

double[,] data = {
    { 1, 2, 3 },
    { 4, 5, 6 },
    { 7, 8, 9 },
};

var hm = myPlot.Add.Heatmap(data);
hm.CellAlignment = Alignment.LowerLeft;

HeatmapCellAlignment

I'll add a cookbook recipe to make this feature more discoverable 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants