Hi all,
I have code to plot each of the cylinder and cone from this discourse. How to combine them into one, so the inverted cone will be inside the cylinder?
The color needs to be adjusted as well, can we make a grid too? Tikz Latex can make grids with foreach
command…
this is the codes for cylinder:
using Plots
plotlyjs()
# If x, y, z are vectors then it won't generate a surface
# for a parameterized surface x,y,z should be matrices:
# Check for: typeof(X), typeof(Y), typeof(Z)
r = 5
h = 3
m, n =200, 150
u = range(0, 2pi, length=n)
v = range(0, h, length=m)
us = ones(m)*u'
vs = v*ones(n)'
#Surface parameterization
X = r*cos.(us)
Y = r*sin.(us)
Z = vs
Plots.surface(X, Y, Z, size=(600,600), cbar=:none, legend=false)
for inverted cone:
using Plots; plotlyjs()
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))