旋转(或循环排列)3D 图的轴?

旋转(或循环排列)3D 图的轴?

默认情况下,3d 图的渲染方式是 z 轴向上,xy 平面为水平。是否可以旋转 3d 图以使 y 轴向上,zx 平面为水平?通过循环排列轴是否可行?

例如,考虑以下由下面的代码块生成的 3d 图,取自这个答案

交叉口图片

我想旋转它,使平面垂直。该怎么做?

\documentclass{scrartcl}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[domain=0.01:30]
\addplot3[surf, opacity=0.25, blue, shader=flat] {0};
\addplot3[surf, opacity=0.25] {(1-0.3)*e^(-x*(y/100)*(1-0.3))-e^(-x*(y/100))};
\addplot3+[domain=4:30,samples=80,samples y=0,mark=none,black, opacity=0.5,thick]({x},{118.89/x},{0.});
\end{axis}
\end{tikzpicture}
\end{document}

澄清。我正在寻找一种绘制垂直表面的方法。此请求用于绘制单个垂直平面这个问题但该解决方案不适用于一般表面。这就是为什么我想到可能以某种方式排列轴的原因。

答案1

我不确定我是否理解了你的问题。但是如果你想“切换平面”,你可以用参数化的方式陈述你的方程,就像你已经对第三个\addplot命令所做的那样。然后只需根据需要切换xyz元素即可。

% used PGFPlots v1.15
\documentclass[border=5pt]{standalone}
\usepackage{pgfplots}
    \pgfplotsset{
        compat=1.15,
    }
\begin{document}
\begin{tikzpicture}
    \begin{axis}[
        domain=0.01:30,
    ]
        \addplot3 [
            surf,
            opacity=0.25,
            blue,
            shader=flat,
        ] {0};
        \addplot3  [
            surf,
            opacity=0.25,
        ] {(1-0.3)*e^(-x*(y/100)*(1-0.3))-e^(-x*(y/100))};
        \addplot3+ [
            domain=4:30,
            samples=80,
            samples y=0,
            mark=none,
            green,
            opacity=0.5,
            ultra thick,
        ]({x},{118.89/x},{0.});
    \end{axis}
\end{tikzpicture}

\begin{tikzpicture}
    \begin{axis}[
%        view={-45}{45},
        domain=0.01:30,
    ]
        \addplot3 [
            surf,
            opacity=0.25,
            blue,
            shader=flat,
        ] (
            {0},
            {x},
            {y}
        );
        \addplot3  [
            surf,
            opacity=0.25,
        ] (
            {(1-0.3)*e^(-x*(y/100)*(1-0.3))-e^(-x*(y/100))},
            {x},
            {y}
        );
        \addplot3+ [
            domain=4:30,
            samples=80,
            samples y=0,
            mark=none,
            green,
            opacity=0.5,
            ultra thick,
        ] (
            {0.},
            {x},
            {118.89/x}
        );
    \end{axis}
\end{tikzpicture}

\begin{tikzpicture}
    \begin{axis}[
%        view={-45}{45},
        domain=0.01:30,
    ]
        \addplot3 [
            surf,
            opacity=0.25,
            blue,
            shader=flat,
        ] (
            {x},
            {0},
            {y}
        );
        \addplot3  [
            surf,
            opacity=0.25,
        ] (
            {x},
            {(1-0.3)*e^(-x*(y/100)*(1-0.3))-e^(-x*(y/100))},
            {y}
        );
        \addplot3+ [
            domain=4:30,
            samples=80,
            samples y=0,
            mark=none,
            green,
            opacity=0.5,
            ultra thick,
        ] (
            {x},
            {0.},
            {118.89/x}
        );
    \end{axis}
\end{tikzpicture}
\end{document}

该图显示了上述代码的结果

答案2

可能损害最小的版本是:

\documentclass{scrartcl}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}[rotate=90]
\begin{axis}[domain=0.01:30,ticklabel style={rotate=-90}] 
\addplot3[surf, opacity=0.25, blue, shader=flat] {0};
\addplot3[surf, opacity=0.25] (x,y,{1-0.3)*e^(-x*(y/100)*(1-0.3))-e^(-x*(y/100)});
\addplot3+[domain=4:30,samples=80,samples y=0,mark=none,black, opacity=0.5,thick]({x},{118.89/x},{0.});
\end{axis}
\end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容