為什麼我的 Tikz 圖片不旋轉?

為什麼我的 Tikz 圖片不旋轉?

這是我的Tikz格式圖片程式碼,我做了很多更改來旋轉它,包括使用一些套件和更改角度值,但它仍然不旋轉,我不知道問題是什麼。

\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},
        ]
        \addplot3[
            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}

另外我不希望數字出現在軸上,我該做什麼改變。

提前致謝。

答案1

讓我們坐下來看看有哪些選擇:

首先,,您不能使用\tdplotxxx旋轉axis。前者來自tikz-3dplot,後者來自pgfplots。他們基本上都是獨立工作。 (題外話:我曾經認為tikz-3dplot> pgfplots;但現在我知道pgfplots>> tikz-3dplot。)

以下僅使用pgfplots

  • 如果您只想旋轉資料點,而不旋轉軸,那麼有一個階段pgfplots允許您修改資料點。filter points在手冊中搜尋。

  • 如果你想將數據點與軸一起旋轉,那麼你可以view={12}{34}rotate=56(2D旋轉)一起使用。這兩者的組合應該為您提供所有可能的 3D 旋轉。

  • 如果只想旋轉軸,請結合前面的兩種方法。

如果你想堅持tikz-3dplot,那麼你就必須放棄axis

相關內容