乳胶柱形图

时间:2017-12-08 03:40:04

标签: latex tikz pgf

尝试使用包含3种颜色的3个不同列中的单个值创建乳胶柱形图。

\begin{tikzpicture}
\begin{axis}[
x tick label style={
    /pgf/number format/1000 sep=},
ylabel=Accuracy,
enlargelimits=0.05,
legend style={at={(0.5,-0.15)},
    anchor=north,legend columns=-1},
ybar interval=0.7,]
\addplot 
 coordinates {(1930,80)};
\addplot 
  coordinates {(1930,80)};
\addplot 
coordinates {(1930,80)};
\legend{Far,Near,Here}
\end{axis}
\end{tikzpicture}

1 个答案:

答案 0 :(得分:1)

您需要添加ybar大小(例如ybar=5pt)并删除ybar interval参数,该参数看起来很虚伪:

\begin{tikzpicture}
    \begin{axis}[
        ybar=5pt,
        ylabel=Accuracy,
        xtick=data,
        legend style={at={(0.5,-0.15)}, anchor=north,legend columns=-1},
        x tick label style={/pgf/number format/1000 sep=},
        enlargelimits=0.05,
    ]
        \addplot coordinates {(1930,80)};
        \addplot coordinates {(1930,80)};
        \addplot coordinates {(1930,80)};
        \legend{Far,Near,Here}
    \end{axis}
\end{tikzpicture}

enter image description here