![tikzpicture 并排](https://linux22.com/image/446660/tikzpicture%20%E5%B9%B6%E6%8E%92.png)
我怎样才能把这张图并排放在一起
\begin{figure}[htb]
\centering
\begin{tikzpicture}
\begin{axis}[
width=0.5\linewidth,
xlabel=$x$,ylabel=$y$
]
\addplot3[surf,domain=-2:2,domain y=-2:2]
{(2-x^2-y^2)};
\end{axis}
\end{tikzpicture}
\caption{Paraboloide de revolución}
\label{pare}
\end{figure}
\hfill
\begin{figure}[htb]
\centering
\begin{tikzpicture}
\begin{axis}[
width=0.5\linewidth,
xlabel=$x$,ylabel=$y$
]
\addplot3[surf,domain=-2:2,domain y=-2:2]
{(x*y)};
\end{axis}
\end{tikzpicture}
\label{pard}
\caption{Paraboloide hiperbólico}
\end{figure}
答案1
您希望两张图片处于同一figure
环境中。使用minipage
。
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[spanish]{babel}
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}
\begin{document}
\begin{figure}[htb]
\begin{minipage}[b]{0.49\textwidth}
\centering
\begin{tikzpicture}
\begin{axis}[
width=0.95\linewidth,
xlabel=$x$,ylabel=$y$
]
\addplot3[surf,domain=-2:2,domain y=-2:2]{(2-x^2-y^2)};
\end{axis}
\end{tikzpicture}
\caption{Paraboloide de revolución}\label{pare}
\end{minipage}\hfill % <--- no blank line here
\begin{minipage}[b]{0.49\textwidth}
\centering
\begin{tikzpicture}
\begin{axis}[
width=0.95\linewidth,
xlabel=$x$,ylabel=$y$
]
\addplot3[surf,domain=-2:2,domain y=-2:2]{(x*y)};
\end{axis}
\end{tikzpicture}
\caption{Paraboloide hiperbólico}\label{pard}
\end{minipage}
\end{figure}
\end{document}