Hi all,
I am confused since a couple of days, because GLMakie and CairoMakie have a different behavior. Here is the MWE:
using CairoMakie
# using GLMakie
x = range(0., 2π, 100)
z = sin.(x)
x = range(0., 2π, 100)
z = sin.(x)
zmin = minimum(z)
lower = [Point3f(x[i], 1, zmin) for i in eachindex(x)]
upper = [Point3f(x[i], 1., z[i]) for i in eachindex(x)]
edge_start = [Point3f(x[1], 1., zmin), Point3f(x[1], 1., z[1])]
edge_end = [Point3f(x[end], 1., zmin), Point3f(x[end], 1., z[end])]
fig = Figure()
ax = Axis3(fig[1,1])
band!(ax, lower, upper, color = (:blue, 0.1))
lines!(ax, upper, color = z, colormap = :viridis)
lines!(ax, edge_start, color = [z[1], z[1]], colormap = :viridis)
lines!(ax, edge_end, color = [z[end], z[end]], colormap = :viridis)
fig # for plotting CairoMakie figure in VSCode
# display(fig) # When using GLMakie
While this code works fine with GLMakie
, it throws the following error when using CairoMakie
: Looking up a non-finite or NaN value in a colormap is undefined.
After inspection, the problem comes from lines!(ax, edge_start, color = [z[1], z[1]], colormap = :viridis)
and lines!(ax, edge_end, color = [z[end], z[end]], colormap = :viridis)
, but I have to admit that I can’t explain why GLMakie
and CairoMakie
behave differently in this case.
Thanks for your help.
versioninfo()
Julia Version 1.8.5
Commit 17cfb8e65ea (2023-01-08 06:45 UTC)
Platform Info:
OS: Linux (x86_64-linux-gnu)
CPU: 20 × Intel(R) Xeon(R) W-2255 CPU @ 3.70GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-13.0.1 (ORCJIT, cascadelake)
Threads: 1 on 20 virtual cores
Environment:
JULIA_EDITOR = code
JULIA_NUM_THREADS = 1
(@v1.8) pkg> st
Status `~/.julia/environments/v1.8/Project.toml`
[13f3f980] CairoMakie v0.7.5
[e9467ef8] GLMakie v0.5.5