using PlotlyJS
f(r,θ) = (r^2)*cos(θ)*sin(2*θ)/1.5
r = range(0, 1, 50)
θ = range(0, 2*pi, 100)
z= [f(s, t) for t in θ, s in r]
x = cos.(θ) * r' #outer product;
y = sin.(θ) * r'
h=-1.4 #project the surface onto the plane z=h
a= 1.15 # the disk radius around which the angles are placed
pl = Plot(surface(x=x, y=y, z=z, coloraxis="coloraxis"),
Layout(width=500, height=500, font_size=11,
coloraxis=attr(colorscale=colors.matter,
colorbar_thickness=23,
colorbar_len=0.75),
scene=attr(zaxis_range=[h-0.1, 0.8],
camera_eye=attr(x=1.6, y=1.6, z=1))))
#project the surface onto the plane z=h and draw the initial surface height as a heatmap on this plane
addtraces!(pl, surface(x=x, y=y, z= h*ones(size(x)), surfacecolor=z,
coloraxis="coloraxis"))
t = range(0, 7pi/4, 8)
txt= [k*45 for k in 0:7]
relayout!(pl, scene_annotations =[
attr(showarrow=false,
x=a*cos(s),
y=a*sin(s),
z=h,
text=txt[k],
font_size=10
) for (k, s) in enumerate(t)])
display(pl)
The WebIO Jupyter extension was not detected. See the WebIO Jupyter integration documentation for more information.