Amandeep Singh
Amandeep Singh

Reputation: 315

Latex Column chart

Trying to create a latex column chart with single values in 3 different columns having 3 colors.

\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}

Upvotes: 0

Views: 1415

Answers (1)

pchaigno
pchaigno

Reputation: 13113

You need to add a ybar size (e.g., ybar=5pt) and remove the ybar interval parameter, which looks bogus:

\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

Upvotes: 1

Related Questions