0

尝试在具有 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}
4

1 回答 1

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}

在此处输入图像描述

于 2017-12-08T14:50:11.010 回答