# 3D Polar surface plot in Julia

I feel there is a need of 3D Polar surface plots. Does any one have Julia equivalent of following MATLAB function ? 3D Polar Plot - File Exchange - MATLAB Central

To plot a surface in polar coordinates does not require a special setup. It is just a parameterized surface, of parameters r and θ.
If you have the surface equation given as z=f(r,θ), r\in [0, r\_{max}], \theta\in [\alpha, \beta], then you get the surface parameterization:

r = range(0, rmax, 30)
θ  =  range(α, β, 100)
z= [f(s, t)  for t  in θ, s in r]
x = cos.(θ) * r' #outer product;
y = sin.(θ) * r'


Now you can plot the surface plot as a surface(x,y,z). At the same time you can project this surface onto an horizontal plane, z=h, and its projection is a disk or a part of disk,of radius r\_{max}. With PlotlyJS you can add the angles around the disk, as 3d annotations.
Could you post your equation z=f(r,θ)?

1 Like

Hi @empet , I used same technique of using parameterized definition myself. The surface generated looks good… but I was hoping like in polarplots it shows the \theta in degrees along the circle… The figures are well-annotated in circular manner. I wished to know if something like that exists.

The equation that I was plotting was that of Bessels function for vibration of circular membranes

I represented an arbitrary function depending on polar coordinates, and added its projection (but it’s not mandatory) and the angle θ in degree:
https://nbviewer.org/gist/empet/904b27982793bdef09c348a3699373d6

1 Like

I implemented Circular membrane vibration in Python, a few years ago, and imported
the Bessel functions of the first kind, and their zeros from scipy.special.
Could you please point out a Julia package for Bessel functions?
LE: I found both functions, respectively in SpecialFunctions.jl, and FunctionZeros.jl

Such PlotlyJS 3D text annotation is currently not possible with Plots.jl.
Is it possible with Makie?

I don’t know if Makie provides 3d annotations.

Animation of a circular membrane vibration, represented as polar surface, with annotated angles:
[Vibrational mode (2, 1) with 1 diametric and 2 circular node lines] (https://media.giphy.com/media/Qz11Z49hmsUcktU3kS/giphy.gif)

Yes… I had used SpecialFunctions.jl(for bessel function definition) and FastGaussQuadrature.jl (for the roots of Bessel functions)

Thanks @empet for the annotaton of angles in degrees. Its the only part I was missing in aesthetics. Rest I managed with FastGaussQuadrature.jl and SpecialFunctions.jl