To plot a circle of radius 2 centered at (1, 1) I do the following:
θ = 0:0.1:2π
x = 1 .+ 2cos.(θ)
y = 1 .+ 2sin.(θ)
plot(x, y, aspect_ratio=:equal)
However, if I want to plot a set of parametric equations with more than two parameters I cannot use this approach. How should one approach plotting parametric equations with more than one parameter in Julia? For instance, how can I plot the cone described by the parametric equations
x = r*cos(θ)
y = r*sin(θ)
z = r
where r
and θ
are the parameters?
I am imagining the final plot to look like in the below image that has been generated by entering ParametricPlot3D[{r*Cos[t], r*Sin[t], r}, {r, -3, 3}, {t, 0, 2*Pi}]
in Mathematica.
This works with the plotly
and pyplot
backends to Plots
but not gr
:
X(r,theta) = r * cos(theta)
Y(r,theta) = r * sin(theta)
Z(r,theta) = r
rs = range(0, 2, length=50)
ts = range(0, 2pi, length=50)
surface(X.(rs',ts), Y.(rs', ts), Z.(rs', ts))