Hello, is there a possibility in Julia to combine several contour plots into one 3D plot like in the picture? I have tried a little bit with GLMike, but did not get it. I would be very happy if there is a solution.
Maybe something like this in Makie?
using Makie
xs = LinRange(-1, 1, 100)
ys = LinRange(-1, 1, 100)
zs = [x^2+y^2 for x in xs, y in ys]
s = contour(xs, ys, zs, transformation=(:yz, -1), levels=10, limits=FRect((-2,-2,-2), (4,4,4)))
contour!(s, xs, ys, zs, transformation=(:yz, 0), levels=10)
contour!(s, xs, ys, zs, transformation=(:yz, 1), levels=10)
Thanks a lot for your help, it worked very well. There are two more things that interest me. I would like to rotate the axis labels by 90 degrees so that they run along the axis. Unfortunately I haven’t read anything in the Makie documentation yet. And is it possible to insert a legend/colorbar to make a connection between the colors and the values?
Thanks again and sorry i am still a beginner
This is a really nice plot!
Here’s a version with rotated axis labels (and rotated tick labels to match), and a colorbar using MakieLayout:
using Makie
using AbstractPlotting.MakieLayout
# Parent scence
scene, layout = layoutscene()
# Scene for main plot
lscene = layout[1, 1] = LScene(scene, camera=cam3d!, raw=false)
s = lscene.scene
# Main plot
xs = LinRange(-1, 1, 100)
ys = LinRange(-1, 1, 100)
zs = [x^2+y^2 for x in xs, y in ys]
style = (levels=10, linewidth=2)
contour!(s, xs, ys, zs, transformation=(:yz, -1); style..., limits=FRect((-2,-2,-2), (4,4,4)))
contour!(s, xs, ys, zs, transformation=(:yz, 0); style...)
contour!(s, xs, ys, zs, transformation=(:yz, 1); style...)
# Axis names
xlabel!(s, "X [mm]")
ylabel!(s, "Y [mm]")
zlabel!(s, "Z⋅10^3 [mm]")
s[Axis][:names][:rotation] = (qrotation(Vec3(0,0,1), π),
qrotation(Vec3(0,0,1), π/2),
qrotation(Vec3(0,0,1), -π/2) * qrotation(Vec3(0,1,0), -π/2))
s[Axis][:names][:align] = ((:center, :right), (:center, :right), (:center, :left))
# Axis ticks
xtickrotation!(s, 1π) # Giving an Irrational fails (probably a bug)
ytickrotation!(s, π/2)
# Colorbar
layout[1, 2] = LColorbar(scene, s[end], width=30)
scene
Maybe you also want more ticks on the x axis, you can change this with
xticks!(s, xtickrange=0:20, xticklabels=["$x" for x in 0:20])
(Makie will hopefully make this easier at some point.)
Please share the final figure (and publication if any) when ready!
Also is the position on the x axis related to time? It could make a nice animation.
Hey, sorry for the late reply. There is a lot to do during the Christmas season
Thanks for the tip with the xticks, I almost despaired of them
The publication will unfortunately take a while, but yes when it’s ready I can share it here.
I have also thought about an animation, but in the spatial presentation you can see the development of the shape at first look.
Thank you and stay healthy