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

nan_color do not work as expected for surface! #4524

Open
3 tasks done
ph-kev opened this issue Oct 24, 2024 · 2 comments
Open
3 tasks done

nan_color do not work as expected for surface! #4524

ph-kev opened this issue Oct 24, 2024 · 2 comments
Labels
bug CairoMakie This relates to CairoMakie, the vector backend for Makie based on Cairo.

Comments

@ph-kev
Copy link

ph-kev commented Oct 24, 2024

  • what version of Makie are you running? (]st -m Makie)

I am using Makie v0.21.14

  • can you reproduce the bug with a fresh environment ? (]activate --temp; add Makie)

I can reproduce the bug with a fresh environment. The bug is that nan_color do not work as expected. I would expect the color of the NaN to be red and not transparent.

using CairoMakie

lons = -180:180
lats = -90:90
field = [exp(cosd(l)) + 3(y/90) for l in lons, y in lats]

field[1:100,1:100] .= NaN

fig = Figure()
ax = Axis(fig[1,1])
surface!(ax, lons, lats, field; shading = NoShading, nan_color = :red)
fig

The code above produce the plot below.

Image

  • What platform + GPU are you on?
    I am using Windows 11 and NVIDIA RTX A2000 Laptop GPU.
@ph-kev ph-kev added the bug label Oct 24, 2024
@asinghvi17 asinghvi17 added the CairoMakie This relates to CairoMakie, the vector backend for Makie based on Cairo. label Oct 24, 2024
@asinghvi17
Copy link
Member

Can confirm this is a bug, but only on CairoMakie (not GLMakie)

@asinghvi17
Copy link
Member

Strangely enough, I can't replicate this with mesh - it seems to be an issue specific to surface.

Mesh example:

using CairoMakie
vertices = [
    0.0 0.0 0.0;
    1.0 0.0 0.0;
    1.0 1.0 0.0;
    0.0 1.0 0.1;
] # points are 3D to make sure this goes through `draw_mesh3d`

faces = [
    1 2 3;
    3 4 1;
]

colors = [1.0, 2.0, 3.0, NaN]

scene = mesh(vertices, faces, color = colors, shading = NoShading, nan_color = :red)

Image

Surface example:

using CairoMakie
surface([1.0 2.0 3.0 4.0 5.0; 3.0 4.0 NaN 4.0 5.0; 1.0 2.0 3.0 4.0 5.0] ./ 10; nan_color = :red)

Image

so clearly something fishy is going on here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug CairoMakie This relates to CairoMakie, the vector backend for Makie based on Cairo.
Projects
None yet
Development

No branches or pull requests

2 participants