答案 0 :(得分:2)
使用pgfplots
可以做到:
\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{width=7cm,compat=1.16}
\begin{document}
\begin{tikzpicture}
\begin{axis}
\addplot+ [
ybar,
error bars/.cd,
y dir=both, y explicit,
] coordinates {
(0,3) +- (0,1)
(1,2) +- (0,0.4)
(2,4) +- (0,1)
(3,1) +- (0,0.6)
(4,2) +- (0,0.1)
};
\end{axis}
\end{tikzpicture}
\end{document}