# Why my Tikz picture doesn't rotate?

Here is my code in Tikzformat picture and I made many changes to rotate it, include using some package and changing in angle values but it still doesn't rotate, I don't know what's the problem.

\documentclass[border=10pt]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.8}
\usepackage{tikz, tikz-3dplot}
\begin{document}
\tdplotsetmaincoords{20}{45}
\begin{tikzpicture}[scale=1]
\tdplotsetrotatedcoords{20}{30}{90}
\begin{axis}[
axis lines=center,
axis on top,
xlabel={$x$}, ylabel={$y$}, zlabel={$z$},
view/h=110,
title={\tiny $\frac{x^2}{a^2}+\frac{y^2}{b^2}=1$, Rotate Please},
]
surf,
z buffer=sort,
mesh/interior colormap={purplegreen}{color=(purple) color=(green)},
colormap={periodic}{%
color=(blue)
color=(yellow)
color=(orange)
color=(red)
color=(orange)
color=(yellow)
color=(blue)},
domain=-2:2, domain y=0:360,
samples=20, samples y=20,
variable=\u, variable y=\v,
point meta=u,
]
({2 * cos(v)},{3 * sin(v)},{u});
\end{axis}
\end{tikzpicture}

\end{document}


Also I don't want the numbers appear on axis', what should I make changes.

• You are using pgfplots! Use view={20}{45} instead! (NO, you cannot use tikz-3dplot's rotation command to rotate pgfplots's plot. They are simply indepedent.) – Symbol 1 Apr 21 '17 at 3:45
• Instead of 'view/h=110' ? – Nosrati Apr 21 '17 at 3:47
• Oops I mislooked that. So you did set the view. Then what you do want to achieve? which part of the picture should be rotated? – Symbol 1 Apr 21 '17 at 3:57
• I want to rotate whole of picture include cylinder and axis'. – Nosrati Apr 21 '17 at 4:02
• Then that is fairly impossible. The axis draws everything on the 2D plane! – Symbol 1 Apr 21 '17 at 4:10

Let us sit down and see what are the options:

First of all, NO, you cannot use \tdplotxxx to rotate axis. The former is from tikz-3dplot and the latter is from pgfplots. They are basically working independently. (off topic: I used to think tikz-3dplot>pgfplots; But now I know pgfplots>>tikz-3dplot.)

The following uses only pgfplots

• If you want to rotate just the data points, not axis, then there is a phase in pgfplots that allows you to modify data points. Search filter points in the manual.

• If you want to rotate the data points together with axis, then you can use view={12}{34} together with rotate=56 (the 2D rotation). The combination of these two should give you all possible 3D rotations.

• If you want to rotate just the axis, combine the previous two methods.

If you want to stick to tikz-3dplot, then you have to give up axis.

• I could't find filter points in my manual file: Tantau Till, TikZ and pgf, Manual for version 3.0.1a (2013). The combine view={12}{34} with rotate=56 gives me something as I wanted. Thank you. – Nosrati Apr 23 '17 at 17:54
• @MyGlasses I mean the manual of pgfplots. Sometimes I mistakenly assume that I am clear. – Symbol 1 Apr 23 '17 at 18:24
• I don't want the numbers appear on axis', what should I make changes in my file, please. – Nosrati Apr 23 '17 at 18:33
• Something like xticklabel={}. – Symbol 1 Apr 23 '17 at 18:40