Hello!
Is there a way creatinge a 3D heatplot using Plots.jl?
I try to visualize a 4D plot by plotting a 3D sphere and coloring the surface according to a function f .
This is the closest I was able to do:
plot(x,y,z, st=:surface)
but now I would like to set the colors on the surface by a function f(x,y,z) and not according to the height z .
Thank you for your help
You can use Plots.jl pyplot()
or plotlyjs()
backends to produce something like this:
Code example:
using Plots; plotlyjs() #or: pyplot()
n = 300
θ = LinRange(0,π,n)
ϕ = LinRange(0,2π,n)
xx = @. sin(θ)*cos(ϕ')
yy = @. sin(θ)*sin(ϕ')
zz = @. cos(θ)*ones(n)'
surface(xx, yy, zz, fill_z = 5*sin.(10xx .* yy), size=(600,600))
The user function needs to be mapped onto the meshgrid and then fill_z
takes over to assign colors from the colormap.
4 Likes
Let us know if you get a nice plot on the sphere that you can share.
It’s always fun to see what one can get by poking mathematical functions around:
Ex.1.1: Golden stripes-1
Ex.1.2: Golden stripes-2
Ex.1.3: Golden stripes-3
4 Likes
How about a little game to spice things up, inviting interested people to share examples without revealing the underlying mathematical function, say until Christmas?
2 Likes
looks great!
I was doing something very classic:
I will definitly play around more
2 Likes
empet
November 1, 2021, 10:48am
9
Bezier surface colormapped according to the green component values of a cat image.
A different camera eye position:
2 Likes