首页 > 解决方案 > 如何使用 LaTex 在条形图上绘制最小值和最大值?

问题描述

有没有办法将最小值和最大值绘制到平均条形图上,类似于下面的附图?

谢谢,

在此处输入图像描述

标签: plotlatexbar-chart

解决方案


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}

在此处输入图像描述


推荐阅读