I recently tried to get started with Makie, since I love the approach and it seems to be fairly huge in features. However, I sometimes struggle in details
I have some data on a sphere, let’s say I have a function
F defined on the sphere. Is there a good way to get a contour-plot on a sphere?
using Makie, Colors, LinearAlgebra A = [8.0 1.0 6.0; 3.0 5.0 7.0; 4.0 9.0 2.0] A = A + A' A = A ./ opnorm(A) F(p) = p' * A * p lat = range(-π, π; length = 101) lon = range(-π/2, π/2; length = 101) spherical_to_euclidean(θ, φ) = [sin(θ) * cos(φ), sin(θ) * sin(φ), cos(θ)] data = [F(spherical_to_euclidean(θ, φ)) for θ in lat, φ in lon]
Then of course a really neat function for a contour plot is
contour3d(lat, lon, data, levels = 11, color = :black, linewidth = 1)
but it’s open the 2D surface (and I would love to combine that with filled surface),
but I would like to have this on a sphere, so maybe for
mesh_x = [spherical_to_euclidean(θ, φ) for θ in lat, φ in lon] mesh_y = [spherical_to_euclidean(θ, φ) for θ in lat, φ in lon] mesh_z = [spherical_to_euclidean(θ, φ) for θ in lat, φ in lon]
a contour function that takes 4 arguments (the meshes and the data). Does something like this exist? That would really be nice. This matrix
Ashould in the end resemble the contours from https://manoptjl.org/stable/assets/logo.png just to give an example what I am aiming for.
edit: It would already be cool to get a fine sampling of the contours from
contours I think, then I could
spherical_to_euclidean those and use a heat map additionally.