我想在 tikzpicture 环境中在两个图形之间添加垂直空间。我使用此选项使 y 轴对齐。那么,如何在图形之间添加垂直空间?
\documentclass[tikz]{standalone}
\usepackage{pgfplots}
\usepackage{mathpazo}
\pgfplotsset{compat=newest}
\begin{document}
\begin{tikzpicture}
\begin{semilogyaxis}[
name=min_AQ_3DFT,
xmin=0, xmax=8, ymin=1e-12, ymax=2,
xtick={0, 1, 2, 3, 4, 5, 6, 7, 8},
ytick={1e-11, 1e-10, 1e-9, 1e-8, 1e-7, 1e-6, 1e-5, 1e-4, 1e-3, 1e-2, 1e-1, 1},
xmajorgrids=true, ymajorgrids=true, yminorticks=true,
xlabel=$\theta_m$, ylabel=$\left|e\left(\frac{A_{m,1}}{A_{m,2}}\right)\right|_{max}$,
legend style={draw=none, legend pos=south west,font=\tiny} ]
\addplot {x^2/1e6};
%\addplot [color=Paired12qual2] table [x index=0, y index=1] {min_AQ_3DFT_err_L_MSD_THD10p.dat};
%\addplot [color=Paired12qual4] table [x index=0, y index=1] {min_AQ_3DFT_err_L_MSL_THD10p.dat};
\legend{min(3DFT)@MSD, min(3DFT)@MSL}
\end{semilogyaxis}
%
\begin{axis}[
at=(min_AQ_3DFT.below south), anchor=above north,
xmin=0, xmax=8, ymin=0, ymax=9,
y=0.5cm/2,
xtick={0, 1, 2, 3, 4, 5, 6, 7, 8},
ytick={2, 4, 6, 8},
xmajorgrids=true, ymajorgrids=true, yminorticks=true,
xlabel=$\theta_m$, ylabel=$L$,
legend style={draw=none, legend pos=south east,font=\tiny} ]
\addplot {x};
\legend{min(3DFT)@MSD, min(3DFT)@MSL}
\end{axis}
\end{tikzpicture}
\end{document}
答案1
yshift
您可以在第二个轴环境的选项中添加。即,
\begin{axis}[
at=(min_AQ_3DFT.below south), anchor=above north,
xmin=0, xmax=8, ymin=0, ymax=9,
y=0.5cm/2,
xtick={0, 1, 2, 3, 4, 5, 6, 7, 8},
ytick={2, 4, 6, 8},
xmajorgrids=true, ymajorgrids=true, yminorticks=true,
xlabel=$\theta_m$, ylabel=$L$,
legend style={draw=none, legend pos=south east,font=\tiny},
yshift=-1cm ] % <-- pay attention to me!
\addplot {x};
\legend{min(3DFT)@MSD, min(3DFT)@MSL}
\end{axis}