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

**URL:** <https://discourse.julialang.org/t/3d-surface-plot-with-gr-backend-error-from-certain-camera-angles/99564>\
**Category:** Visualization\
**Created:** [May 29, 2023, 1:20pm UTC](https://discourse.julialang.org/t/3d-surface-plot-with-gr-backend-error-from-certain-camera-angles/99564 "2023-05-29T13:20:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bast](https://avatars.discourse-cdn.com/v4/letter/b/3e96dc/32.png) [@bast](https://discourse.julialang.org/u/bast)\
**Post date:** [May 29, 2023, 1:20pm UTC](https://discourse.julialang.org/t/3d-surface-plot-with-gr-backend-error-from-certain-camera-angles/99564/1 "2023-05-29T13:20:34Z")

</div>

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:

```julia
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?

---

<div class="post-metadata">

**Author:** ![empet](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/empet/32/221303_2.png) [@empet](https://discourse.julialang.org/u/empet)\
**Post date:** [May 29, 2023, 4:51pm UTC](https://discourse.julialang.org/t/3d-surface-plot-with-gr-backend-error-from-certain-camera-angles/99564/2 "2023-05-29T16:51:35Z")

</div>

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.
