I am running in some unexpected behavior with GLMakie, surface plots and matrices that contain NaN as a value.
My minimum working example below produces the following plots of three different 4 x 4 matrices with different elements set to NaN:
- What causes the darker shading of cells adjacent to a NaN value?
- The right most example is, frankly, somewhat weird to me (why is the surface dropping to a low value and becomes transparent like this?)
The behavior that I would like to have is that all tiles that have a NaN value as one of its vertices are simply not displayed. Is this doable with some tinkering of attributes of the surface?
Here the MWE code reproducing the above figures:
using GLMakie
x = 0.0:3.0
y = 0.0:3.0
Z1 = reshape([100*i+50*j for i in x for j in y], (length(x), length(y)))
Z2 = copy(Z1)
Z3 = copy(Z1)
Z2[1,1] = NaN
Z3[1:2, 1:2] .= NaN
f = Figure(resolution = (800, 800))
ax1 = Axis3(f[1, 1], aspect = (1, 1, 1))
ax2 = Axis3(f[1, 2], aspect = (1, 1, 1))
ax3 = Axis3(f[1, 3], aspect = (1, 1, 1))
surface!(ax1,x,y,Z1)
surface!(ax2,x,y,Z2)
surface!(ax3,x,y,Z3)