在独立环境中垂直对齐两个 tikz 图片

在独立环境中垂直对齐两个 tikz 图片

如果我用类似的东西

\开始{tikzpicture} ... \结束{tikzpicture}

\开始{tikzpicture} ... \结束{tikzpicture}

代码如下这里

最终我会得到在此处输入图片描述 然而,我想要的是类似以下内容:

在此处输入图片描述

这可能吗?非常感谢!

答案1

您所要做的就是在单一tikzpicture环境中构建两个图形,然后将第二个图形向下移动:

编辑:

要从第一个图形中删除 xtick,请按如下方式更改选项:xtick=\empty

\node [anchor=center] at (rel axis cs: 0.1,1.) {$(a)$};
%\end{tikzpicture}
%\begin{tikzpicture}
  \begin{axis}[yshift=-25mm,xlabel=$\theta$ ,

背面

\documentclass{standalone}
\usepackage{ amsmath,amssymb}
\usepackage{graphicx}% Include figure files
\usepackage{dcolumn}% Align table columns on decimal point
\usepackage{bm}% bold math
\usepackage{hyperref}% add hypertext capabilities
%\usepackage[mathlines]{lineno}% Enable numbering of text and display math
%\linenumbers\relax % Commence numbering lines
\usepackage{natbib}
\usepackage{subfigure}
\usepackage{tikz}
\usepackage[bottom]{footmisc}
\usepackage{pgfplots}
\usetikzlibrary{decorations.markings}
\pgfplotsset{width=15cm,compat=1.9}
\pgfplotsset{yticklabel style={text width=2em,align=right}}
\newcommand{\subfigimg}[3][,]{%
 \setbox1=\hbox{\includegraphics[#1]{#3}}% Store image in box
 \leavevmode\rlap{\usebox1}% Print image
 \rlap{\hspace*{5pt}\raisebox{\dimexpr\ht1-\baselineskip}{#2}}% Print label
 \phantom{\usebox1}% Insert appropriate spcing
}
\begin{document}
\begin{tikzpicture}
  \begin{axis}[
  %xlabel=$\theta$ , 
%   ylabel=$\dot{\theta}\quad\textbf{[} \frac{k_BT}{\hbar}\textbf{]}$ ,
    ylabel=$\dot{\theta}\quad\textbf{[} \text{rad./ns}\textbf{]}$ ,
    compat=1.5.1,grid style={ultra thin},every axis plot post/.append style={thick},
%    x tick label style={font=\tiny},y tick label style={font=\tiny},
%   title={Phase-space trajectory},
    grid=both,
    minor grid style={gray!25},
    major grid style={gray!25}, 
    width=0.35\textwidth,
    xticklabels={ $-\frac{5\pi}{12}$,$-\frac{\pi}{3}$,$-\frac{\pi}{4}$,$-\frac{\pi}{6}$,$-\frac{\pi}{12}$},
  xtick=\empty,
  xmin=-5/12*pi,
   xmax=-1/12*pi,
  xticklabel style={text height=2ex}, 
  legend style={at={(1.35,0.4)},anchor=north,nodes={right}}, 
    no marks]
      \addplot[color=red, decoration={
  markings,
  mark=between positions 0.2 and 0.5 step 50em with {\arrow [scale=1.5]{stealth}}
  }, postaction=decorate] table {Trajectory_1_new.csv};
        \addplot[color=black, decoration={
  markings,
  mark=between positions 0.2 and 0.5 step 50em with {\arrow [scale=1.5]{stealth}}
  }, postaction=decorate] table {Trajectory_2_new.csv};
    %        \addplot[mark=*] coordinates {(-pi/4,-0.03)} node[]{*} ;
 %       \addplot [only marks,mark=*,mark size=1.5pt] coordinates{(-pi/4,-0.03)};
             \addplot[mark=*] coordinates {(-pi/4,0)} node[pin=120:{initial point}]{} ;
   \end{axis}
    \node [anchor=center] at (rel axis cs: 0.1,1.) {$(a)$};
%\end{tikzpicture}
%\begin{tikzpicture}
  \begin{axis}[yshift=-25mm,xlabel=$\theta$ ,
   ylabel=$U \quad\textbf{[} \text{meV}\textbf{]}$ ,
    compat=1.5.1,grid style={ultra thin},every axis plot post/.append style={thick},
%   title={Phase-space trajectory},
    grid=both,
    minor grid style={gray!25},
    major grid style={gray!25},
    width=0.35\textwidth,
    xticklabels={ 
       $-\frac{5\pi}{12}$,$-\frac{\pi}{3}$,$-\frac{\pi}{4}$,$-\frac{\pi}{6}$,$-\frac{\pi}{12}$},
  xtick={-1.309,-1.0472, ...,0},
  xmin=-5/12*pi,
   xmax=-1/12*pi,
    xticklabel style={text height=2ex},
      yticklabel style={text height=2ex}, 
     legend style={at={(1.35,0.6)},anchor=north,nodes={right}},
    no marks]
        \addplot [color=red] table {U_+.csv};
  \addplot [color=black] table {U_-.csv};
  \addplot [only marks,mark=*,mark size=1.5pt] table{U_min.csv};
   \end{axis}
    \node [anchor=center] at (rel axis cs: -0.65,1.) {$(b)$};
\end{tikzpicture}
\end{document}

相关内容