Hi,
under the Python and Julia sections of the 3d surface charts there is an example implementation of the Ring Cyclide, which is a closed surface in which the z coordinate is an independent variable.
I am interested in implementing the same chart in Plotly JS, but using the same exact configuration I end up with an empty chart. How’s that possible?
Can anyone provide a JavaScript version of the Python example?
Thank you in advance.
Hi @fmone,
This is an implementation in PlotlyJS.jl of a cyclide:
using PlotlyJS
a, b = 1, 0.99
c = 0.1983
μ = 0.5
thetal = range(-π, π, length=100)
psil = range(-π, π, length=100)
θ, ψ = [s for t in psil, s in thetal], [t for t in psil, s in thetal]
d = @. a-c*cos(θ)*cos(ψ)
x = @. (μ* (c-a*cos(θ)*cos(ψ))+ b^2*cos(θ) )/d
y = @. (b* sin(θ) * (a-μ*cos(ψ)) )/d
z = @. (b* sin(ψ) * (c*cos(θ)-μ))/d;
fig = Plot(surface(x=x, y=y, z=z, colorscale=colors.viridis,
colorbar_len=0.5, colorbar_thickness=25),
Layout(width=600, height=600, scene_camera_eye=attr(x=2, y=2, z=1.2),
font_size=11))