如何在 PGFPlots 中的独立文档中将多个图形与其 y 轴对齐?

如何在 PGFPlots 中的独立文档中将多个图形与其 y 轴对齐?

我已经使用 在一页中创建了两个图表\documentclass[varwidth]{standalone}在此处输入图片描述我怎样才能将它们与它们的对齐y-axis?我试过了\begin{tikzpicture}[trim axis left],但它切断了上图的右侧部分。完整的代码是

\documentclass[varwidth]{standalone}

\usepackage{pgfplots}
\usepackage{pgfplotstable}
\usepackage{tikz}
\usetikzlibrary{tikzmark}

\pgfplotsset{compat=1.15}
\pgfplotsset{label style={font=\Large},
            tick label style={font=\Large}}

\pgfplotsset{error bars/.cd,
    x dir=both, x explicit,
    y dir=both, y explicit,
    }

\begin{document}

\begin{tikzpicture}
\begin{axis}[
    enable tick line clipping=false,
    axis line style=semithick,
    width=9cm,
    height=7cm,
    only marks,
    x tick style={black,semithick},
    x label style=
        {at={(ticklabel cs:0.5)},anchor=near ticklabel},
    xlabel={$\epsilon_n$ [-]},
    xmin=0,xmax=1,
    xtick={0,0.2,...,1},
    xtick pos=bottom,
    xtick align=outside,
    y tick style={black,semithick},
    y label style=
        {at={(ticklabel cs:0.5)},anchor=near ticklabel},
    ylabel={$\sigma_n$ [MPa]},
    ymin=0,ymax=200,
    ytick={0,50,...,200},
    ytick pos=left,
    ytick align=outside,
]
    \addplot [black,mark=*,mark options={scale=0.5,fill=white,very thin}] file {isotropicMD.txt};

    \addplot [black,mark=square*,mark options={scale=0.5, fill=white,very thin}] file {isotropicTD.txt};

\end{axis}
\end{tikzpicture}

\begin{tikzpicture}
\begin{axis}[
    enable tick line clipping=false,
    axis line style=semithick,
    width=9cm,
    height=5cm,
    only marks,
    legend style={at={(0.95,0.3)},draw=none},
    legend cell align={left},
    x tick style={black,semithick},
    x label style=
            {at={(ticklabel cs:0.5)},anchor=near ticklabel},
    xlabel={$L$ [mm]},
    xmin=0,xmax=30,
    xtick={0,10,...,30},
    xtick pos=bottom,
    xtick align=outside,
    y tick style={black,semithick},
    y label style=
        {at={(ticklabel cs:0.5,2)},anchor=near ticklabel},
    ylabel={$F$ [N/$10$\,mm]},
    ymin=0,ymax=4,
    ytick={0,1,...,4},
    ytick pos=left,
    ytick align=outside,
]
    \addplot [black,mark=*,mark options={scale=0.5, fill=white,very thin}] file {isotropicMD1.txt};

    \addplot [black,mark=square*,mark options={scale=0.5, fill=white,very thin}] file {isotropicTD1.txt};

\end{axis}
\end{tikzpicture}

\end{document}

相关内容