I'm trying to draw a 3d cylinder using TikZ-3dplot, but the cylinder walls are not aligned properly (as you can see in the image).
Does anybody knows what am I doing wrong?
\documentclass{article}
\usepackage{tikz}
\usepackage{tikz-3dplot}
\begin{document}
\pgfmathsetmacro{\thetadisp}{60}
\pgfmathsetmacro{\phidisp}{170}
\tdplotsetmaincoords{\thetadisp}{\phidisp}
\pgfmathsetmacro{\rvec}{.8}
\pgfmathsetmacro{\thetavec}{15}
\pgfmathsetmacro{\phivec}{30}
\begin{tikzpicture}[scale=10,tdplot_main_coords]
\coordinate (O) at (0,0,0) node[anchor=north]{$o$};
\draw[thick,->] (0,0,0) -- (1,0,0) node[anchor=east]{$x$};
\draw[thick,->] (0,0,0) -- (0,1,0) node[anchor=north west]{$y$};
\draw[thick,->] (0,0,0) -- (0,0,1) node[anchor=south east]{$z$};
\tdplotsetcoord{P}{\rvec}{\thetavec}{\phivec};
\draw[thick,color=gray,->] (O) -- (P);
\tdplotsetrotatedcoords{\phivec}{\thetavec}{0}
\tdplotsetcoord{A}{0.2}{90+\thetavec}{0};
\draw[thin,tdplot_rotated_coords,fill=gray] (A) arc[start angle=0,delta angle=180,radius=.2] -- ++(0,0,\rvec) arc[start angle=180,delta angle=-180,radius=.2] -- cycle;
\draw[thin,tdplot_rotated_coords,fill=green] (0,0,\rvec) circle[radius=.2];
\draw[thick,tdplot_rotated_coords,->] (0,0,0) -- (.2,0,0) node[anchor=north east]{$x'$};
\draw[thick,tdplot_rotated_coords,->] (0,0,0) -- (0,.2,0) node[anchor=west]{$y'$};
\draw[thick,tdplot_rotated_coords,->] (0,0,0) -- (0,0,.2) node[anchor=south west]{$z'$};
\end{tikzpicture}
\end{document}
