首頁>LaTeX>source

我有一个圖表,其中包含使用此代碼生成的一些錯誤欄,但錯誤欄已搞亂。

\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\pgfplotsset{
every axis/.append style={
scale only axis,   
},
/tikz/every picture/.append style={
baseline,
trim axis left,
trim axis right,
    }
}
\begin{document}
\begin{tikzpicture}
\begin{axis}[%
width=4.5in,
height=3.5in,
scale only axis,
xmode=log,
xmin=0.001,
xmax=1,
xminorticks=true,
ymin=0,
ymax=250
]
\addplot [color=blue,solid,forget plot]
 plot [error bars/.cd, y dir = both, y explicit]
 table[row sep=crcr, y error plus index=2, y error minus index=3]{0.0625469 25.07   0.25    0.25\\
0.0390918   54.77   0.649999999999999   0.649999999999999\\
0.0244324   154.33  1.5 1.5\\
0.0152702   200 5.5 5.5\\
0.00954391  208.67  5.5 5.5\\
0.00596494  215.33  6   6\\
0.00372809  219 2.5 2.5\\
0.00233006  220.67  5   5\\
0.00145628  221 1.5 1.5\\
};
\end{axis}
\end{tikzpicture}%
\end{document}

但如果我删除

\pgfplotsset{
every axis/.append style={
scale only axis,   
},
/tikz/every picture/.append style={
baseline,
trim axis left,
trim axis right,
    }
}

看起来很好.問题就像那个 pgfplotset   在我的文件中尽早命令控製所有對齐和轴修剪.任何解決方案?

谢谢

最新回復
  • 2019-12-5
    1 #

    移動引數 trim axis left   和 trim axis right   来自 pgfplotsset   到了 tikzpicture   環境:

    代碼

    \documentclass[border=1cm]{standalone}%{article}
    \usepackage{pgfplots}
    \pgfplotsset{compat=newest}
    \pgfplotsset{
    every axis/.append style={
    scale only axis,   
    },
    /tikz/every picture/.append style={
    baseline,
        }
    }
    \begin{document}
    \begin{tikzpicture}[trim axis left,
    trim axis right]
    \begin{axis}[%
    width=4.5in,
    height=3.5in,
    scale only axis,
    xmode=log,
    xmin=0.001,
    xmax=1,
    xminorticks=true,
    ymin=0,
    ymax=250
    ]
    \addplot [color=blue,solid,forget plot]
     plot [error bars/.cd, y dir = both, y explicit]
     table[row sep=crcr, y error index=2, y error index=3]{0.0625469 25.07   0.25    0.25\\
    0.0390918   54.77   0.649999999999999   0.649999999999999\\
    0.0244324   154.33  1.5 1.5\\
    0.0152702   200 5.5 5.5\\
    0.00954391  208.67  5.5 5.5\\
    0.00596494  215.33  6   6\\
    0.00372809  219 2.5 2.5\\
    0.00233006  220.67  5   5\\
    0.00145628  221 1.5 1.5\\
    };
    \end{axis}
    \end{tikzpicture}%
    \end{document}
    

  • LaTeX tikz pgf:同餘關係而不是箭頭
  • 表格中的水平線来自文章文件類但在beamer中不可见