同一轴上的两个图 \addplot3 (pgfplots)

Two graphs in the same axes \addplot3 (pgfplots)

我想用 pgfplots 画两张图。这是第一个:

\begin{tikzpicture}
     \begin{axis}[
        xmin=-pi,
        xmax=pi,
        ymin=-pi,
        ymax=pi,
        zmin=0,
        zmax=2.5,
        xlabel={$\varkappa_x$},
        ylabel={$\varkappa_y$},
        zlabel={$\omega$},
        xtick={-pi,-pi/2,0,pi/2,pi},
        xticklabels={$-\pi$,$-\frac{\pi}{2}$,[=10=]$,$\frac{\pi}{2}$,$\pi$},
        ytick={-pi,-pi/2,0,pi/2,pi},
        yticklabels={$-\pi$,$-\frac{\pi}{2}$,[=10=]$,$\frac{\pi}{2}$,$\pi$}
        ]
        \addplot3[surf,domain=-pi:pi,samples=40]{sqrt(2*sin(deg((x+y)/2))^2+sin(deg(x/2))^2+sin(deg(y/2))^2-sqrt(4*sin(deg((x+y)/2))^4+(sin(deg(x/2))^2-sin(deg(y/2))^2)^2))};
     \end{axis}
  \end{tikzpicture}

,

这是第二个:

\begin{tikzpicture}
     \begin{axis}[
        xmin=-pi,
        xmax=pi,
        ymin=-pi,
        ymax=pi,
        zmin=0,
        zmax=2.5,
        xlabel={$\varkappa_x$},
        ylabel={$\varkappa_y$},
        zlabel={$\omega$},
        xtick={-pi,-pi/2,0,pi/2,pi},
        xticklabels={$-\pi$,$-\frac{\pi}{2}$,[=11=]$,$\frac{\pi}{2}$,$\pi$},
        ytick={-pi,-pi/2,0,pi/2,pi},
        yticklabels={$-\pi$,$-\frac{\pi}{2}$,[=11=]$,$\frac{\pi}{2}$,$\pi$}
        ]
        \addplot3[surf,domain=-pi:pi,samples=40]{sqrt(2*sin(deg((x+y)/2))^2+sin(deg(x/2))^2+sin(deg(y/2))^2+sqrt(4*sin(deg((x+y)/2))^4+(sin(deg(x/2))^2-sin(deg(y/2))^2)^2))};
     \end{axis}
  \end{tikzpicture}

.

当我尝试在同一轴上绘制两个图形时,会发生这种情况

\begin{tikzpicture}
     \begin{axis}[
        xmin=-pi,
        xmax=pi,
        ymin=-pi,
        ymax=pi,
        zmin=0,
        zmax=2.5,
        xlabel={$\varkappa_x$},
        ylabel={$\varkappa_y$},
        zlabel={$\omega$},
        xtick={-pi,-pi/2,0,pi/2,pi},
        xticklabels={$-\pi$,$-\frac{\pi}{2}$,[=12=]$,$\frac{\pi}{2}$,$\pi$},
        ytick={-pi,-pi/2,0,pi/2,pi},
        yticklabels={$-\pi$,$-\frac{\pi}{2}$,[=12=]$,$\frac{\pi}{2}$,$\pi$}
        ]
        \addplot3[surf,domain=-pi:pi,samples=40]{sqrt(2*sin(deg((x+y)/2))^2+sin(deg(x/2))^2+sin(deg(y/2))^2-sqrt(4*sin(deg((x+y)/2))^4+(sin(deg(x/2))^2-sin(deg(y/2))^2)^2))};
        \addplot3[surf,domain=-pi:pi,samples=40]{sqrt(2*sin(deg((x+y)/2))^2+sin(deg(x/2))^2+sin(deg(y/2))^2+sqrt(4*sin(deg((x+y)/2))^4+(sin(deg(x/2))^2-sin(deg(y/2))^2)^2))};
     \end{axis}
  \end{tikzpicture}

,

也就是说,我的第二张图在零附近与第一张图重叠。如何使零重叠附近的第一张图与第二张图重叠?很明显,如果我改变调用 \addplot3 的顺序,那么第一个图形将与第二个图形处处重叠。我想只在零附近,这样图片看起来才正确类似这样

TEX 文件

\documentclass{standalone}

\usepackage{tikz}
\usepackage{pgfplots}
\usepackage{pgfplotstable}
\usepackage{amsmath,amssymb}
\usepackage[T2A]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english, russian]{babel}


\pgfplotsset{compat=1.9}

\begin{document}
            \begin{tikzpicture}
                \begin{axis}[
                    xmin=-pi,
                    xmax=pi,
                    ymin=-pi,
                    ymax=pi,
                    zmin=0,
                    zmax=2.5,
                    xlabel={$\varkappa_x$},
                    ylabel={$\varkappa_y$},
                    zlabel={$\omega$},
                    xtick={-pi,-pi/2,0,pi/2,pi},
                    xticklabels={$-\pi$,$-\frac{\pi}{2}$,[=13=]$,$\frac{\pi}{2}$,$\pi$},
                    ytick={-pi,-pi/2,0,pi/2,pi},
                    yticklabels={$-\pi$,$-\frac{\pi}{2}$,[=13=]$,$\frac{\pi}{2}$,$\pi$}
                    ]
                    \addplot3[surf,domain=-pi:pi,samples=35]{sqrt(2*sin(deg((x+y)/2))^2+sin(deg(x/2))^2+sin(deg(y/2))^2-sqrt(4*sin(deg((x+y)/2))^4+(sin(deg(x/2))^2-sin(deg(y/2))^2)^2))};
                    \addplot3[surf,domain=-pi:pi,samples=35]{sqrt(2*sin(deg((x+y)/2))^2+sin(deg(x/2))^2+sin(deg(y/2))^2+sqrt(4*sin(deg((x+y)/2))^4+(sin(deg(x/2))^2-sin(deg(y/2))^2)^2))};
                \end{axis}
        \end{tikzpicture}
\end{document}

您可以重绘第一个函数的部分内容:

\documentclass{standalone}

\usepackage{pgfplots}

\begin{document}

\begin{tikzpicture}
     \begin{axis}[
        xmin=-pi,
        xmax=pi,
        ymin=-pi,
        ymax=pi,
        zmin=0,
        zmax=2.5,
        xlabel={$\kappa_x$},
        ylabel={$\kappa_y$},
        zlabel={$\omega$},
        xtick={-pi,-pi/2,0,pi/2,pi},
        xticklabels={$-\pi$,$-\frac{\pi}{2}$,[=10=]$,$\frac{\pi}{2}$,$\pi$},
        ytick={-pi,-pi/2,0,pi/2,pi},
        yticklabels={$-\pi$,$-\frac{\pi}{2}$,[=10=]$,$\frac{\pi}{2}$,$\pi$}
        ]
        \addplot3[surf,domain=-pi:pi,samples=40]{sqrt(2*sin(deg((x+y)/2))^2+sin(deg(x/2))^2+sin(deg(y/2))^2-sqrt(4*sin(deg((x+y)/2))^4+(sin(deg(x/2))^2-sin(deg(y/2))^2)^2))};
        \addplot3[surf,domain=-pi:pi,samples=40]{sqrt(2*sin(deg((x+y)/2))^2+sin(deg(x/2))^2+sin(deg(y/2))^2+sqrt(4*sin(deg((x+y)/2))^4+(sin(deg(x/2))^2-sin(deg(y/2))^2)^2))};
        \addplot3[
          surf,
          domain=0:pi, 
          y domain=-pi:0,
          samples=20,
        ]{sqrt(2*sin(deg((x+y)/2))^2+sin(deg(x/2))^2+sin(deg(y/2))^2-sqrt(4*sin(deg((x+y)/2))^4+(sin(deg(x/2))^2-sin(deg(y/2))^2)^2))};        
     \end{axis}
  \end{tikzpicture}

\end{document}