3D surface plot with GR backend error from certain camera angles

Hi,

I am trying to do a surface plot on data with missing/NaN values but the camera angle that I want gives me the error: “GKS: Colour index is invalid in routine SET_FILL_COLOR_INDEX” and the coloring is all black.

Using pyplot as backend does not result in this unexpected behavior.

Find a MWE that produces this behavior below:

using Plots
using LinearAlgebra
gr()
M=10
mat = fill(NaN, M,M)
for i in 1:M
    for j in 1:M
        if i > j 
            continue
        else
            mat[i,j] = -1 +1/i
        end
    end
end
mat[1,:] .=-1

mat[I(M)].= [-1 + -0.05*i for i in 1:M]
wireframe(1:M,1:M, mat', camera=(70,30))
surface!(1:M,1:M, mat', alpha=0.8)


wireframe(1:M,1:M, mat', camera=(270,30))
surface!(1:M,1:M, mat', alpha=0.8)

The first camera angle works fine, the second produces the error.

Is this a bug or is there a reason for this behavior?

1 Like

For the second surface, with camera=(-90, 30), I got the right color, not the dark one as with (270, 30), but the scene/axes are strangely positioned.