I want to draw two graphs using pgfplots. Here's the first one:
\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}$,$0$,$\frac{\pi}{2}$,$\pi$},
ytick={-pi,-pi/2,0,pi/2,pi},
yticklabels={$-\pi$,$-\frac{\pi}{2}$,$0$,$\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}
,
here's the second one:
\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}$,$0$,$\frac{\pi}{2}$,$\pi$},
ytick={-pi,-pi/2,0,pi/2,pi},
yticklabels={$-\pi$,$-\frac{\pi}{2}$,$0$,$\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}
.
When I try to plot both graphs in the same axes, this is what happens
\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}$,$0$,$\frac{\pi}{2}$,$\pi$},
ytick={-pi,-pi/2,0,pi/2,pi},
yticklabels={$-\pi$,$-\frac{\pi}{2}$,$0$,$\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}
,
that is, my second graph overlaps the first one in the vicinity of zero. How can I make the first graph in the vicinity of zero overlap with the second one? It is clear that if I change the sequence of calling \addplot3, then the first graph will overlap with the second one everywhere. I would like only in the vicinity of zero, so that the picture looks correct similar as this
TEX file
\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}$,$0$,$\frac{\pi}{2}$,$\pi$},
ytick={-pi,-pi/2,0,pi/2,pi},
yticklabels={$-\pi$,$-\frac{\pi}{2}$,$0$,$\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}
You can redraw parts of your first function: