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 has a build-in Divide by zero bug #2072

Open
Spordoz opened this issue Apr 11, 2024 · 7 comments
Open

Heatmap has a build-in Divide by zero bug #2072

Spordoz opened this issue Apr 11, 2024 · 7 comments

Comments

@Spordoz
Copy link

Spordoz commented Apr 11, 2024

Steps to reproduce

  1. Have plot with log axis
  2. Add heatmap which can have X0 = 0
  3. Plot

Platform: Windows
.NET version: 7.0
Oxyplot verion: 2.1.2

Expected behaviour

Plot heatmap in log scaling

Actual behaviour

Divide by zero and crash plot with infinite width because if axis is logarithmic: right and top are log(x1/x0)

image

@VisualMelon
Copy link
Contributor

You can't plot zero on a log axis: what sort of output are you expecting? We should probably detect this and throw a more useful exception.

@Spordoz
Copy link
Author

Spordoz commented Apr 11, 2024

You indeed can't plot 0 on a log. but it can have 0 if the axis is not a log axes. I just expect it to handle it a little better. Because it is possible and not uncommon to be able to switch between log and non-log axes with the press of a button. For it to break the moment you switch is not desired. I would expect it to check for 0 and maybe change it slightly so the calculation does not go into infinity.

@Spordoz
Copy link
Author

Spordoz commented Apr 11, 2024

In this case I was trying to use a heatmapseries to display the density of a scatterseries. The scatterpoint can be so spread out that it sometimes needs the option to switch the axes to log axes.

@VisualMelon
Copy link
Contributor

VisualMelon commented Apr 11, 2024

I'd have thought you'd have to recalculate the density map when changing the axis (and so compute new bounds in the log space), otherwise the alignment will necessarily be wrong. I can't really think what the correct behaviour could possibly be for this beside throwing or plotting nothing, but if you have a mock-up showing what you expect please feel free to share it.

@Spordoz
Copy link
Author

Spordoz commented Apr 12, 2024

I think you are right on that part now that I think about it some more, Ill have to figure out why my code outputs a minimum X of 0 in log space. Because the spacing and density would indeed for sure be different in log space

@Spordoz
Copy link
Author

Spordoz commented Apr 12, 2024

It also seems that just adding a color axis prevents the scatterSeries from properly showing its non selected points, which is kinda weird. The heatmapseries unfortunately needs it.

@VisualMelon
Copy link
Contributor

Re. ScatterSeries, I can't remember exactly what was going on, but that sounds like it's related to #1963

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

No branches or pull requests

2 participants