I used the following code, below which is altered from https://latexdraw.com/draw-a-plane-intersecting-a-cone-in-latex/
\documentclass{standalone}
\usepackage{pgfplots}
\usepgfplotslibrary{colormaps}
\pgfplotsset{compat = newest}
\begin{document}
%Draw axis x, y and z, with grid on each plane of the axis
\begin{tikzpicture}
\begin{axis}[
axis equal image,
grid = both,
minor tick num = 2,
xlabel = {$x$},
ylabel = {$y$},
zlabel = {$z$},
major grid style = {draw = lightgray},
minor grid style = {draw = lightgray!25},
legend cell align={left},
xmin = -1, xmax = 1,
ymin = -1, ymax = 1,
scale = 3,
zmin = 0, zmax = 2,
z buffer = sort,
]
% Here comes the code
\addplot3[
surf,
shader = interp,
samples = 50,
samples y = 20,
domain = 0:2*pi,
domain y = 0:1,
colormap/violet,
]
(
{cos(deg(x)) * y},
{sin(deg(x)) * y},
{y}
);
\end{axis}
\end{tikzpicture}
\end{document}
but it has inverted the cone and I cannot think why, I tried to alter the z-axis to -y but this didn't work. Can anybody help me to turn the cone around? Thanks.