As the title says, I’m plotting a graph with very high peaks, but the output is really weird at (x,y)=(0.5,0.5) with no peaks at around 5*10^11. I’m not really sure why that is.
using GLMakie
f(x, y) = y^2 / ((x - 0.5)^2 + 10^-12) + x^2 / ((y - 0.5)^2 + 10^-12)
x = range(start=0, stop=1, step=0.0001)
y = range(start=0, stop=1, step=0.0001)
z = [f(xi, yi) for xi in x, yi in y]
fig = Figure()
ax = Axis3(fig[1, 1])
surface!(ax, x, y, z, colormap = :viridis)
fig
This looks like the perfect use case for a logarithmic-scale axis. I’m not sure how to do this off-hand in Makie but ChatGPT suggests the following might work
Edit:
The docs for Axis3 don’t reference {x,y,z}scale attributes, but the docs for Axis do include {x,y}scale. If those translate, then it looks like you might be able to just add zscale=log to the keyword arguments for Axis3.
Maybe just trouble rendering very thin peaks, in this case 1 element. Screens that typically get up to 1920 pixels plausibly skip most of the 10001 values each dimension, and it doesn’t know what important values to keep. If this is the case, could try sharply narrowing the limits. Tossed the equation into Wolfram Alpha, the contour plot seems to confirm that the visible slabs widen enough to be rendered. Surface plot not shown because it cuts it off at z=300 no matter what.
Yeah, increasing the step to reduce the number of elements like that just about confirms it. Just a fundamental limitation, like not being able to spot a microbe without a microscope. A peak detection algorithm should not be affected by rendering resolution, just the data’s sampling rate, but I’ve never worked with one that works over 2 independent variables.