# How to produce a 3D surface plot by rotating the 2D plot of a function?

What I want to do is to produce a 3d plot of a surface of revolution. So far I have achieved the following code...

\documentclass[border= 5mm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{colormap={bluered}{rgb255(0cm)=(0,0,180);rgb255(1cm)=(0,255,255);rgb255(2cm)=(100,255,0);rgb255(3cm)=(255,255,0);rgb255(4cm)=(255,0,0); rgb255(5cm)=(128,0,0)}}
\begin{document}
\begin{tikzpicture}
\begin{axis} [colormap/bluered]
\end{axis}
\end{tikzpicture}
\end{document}


This ends up in the function on sin(x) along the x axis, and rotated around the x axis again forming a lobe...The image is here: What I need is... the function (let's say sin(x)), to be along the x axis but rotated around the z axis...(The image should be like the waves on the water when a rock falls in...for the sin(x)).

Also there is a problem with the colours...It seems that those yellows on top shouldn't be there...

For plots like this, it's typically a good idea to use z buffer=sort to make sure the elements appear in the right order.

To get a surface made up of a function rotated around the z axis, you can use an expression like:

    ({sin(x)*y},{cos(x)*y},{ <function of y> });


where function of y is the function you want to rotate: \documentclass[border= 5mm]{standalone}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis} [colormap/greenyellow, axis equal]

• @Ariscampis: What version of PGFPlots are you using? And how are you compiling the document (pdflatex? lualatex?) – Jake Nov 4 '13 at 8:31