2

I am using PGFplot to make a barchart. There are 4 entries in my csv file and unfortunately I have only 3 bars in my figure.

my LaTeX code:

\begin{figure}
    \centering
    \begin{tikzpicture} 
        \begin{axis}[
            x tick label style={/pgf/number format/1000 sep=},
                xlabel=Sequence,
            ylabel=Heigth,
                ymin=0.7,
            enlargelimits=0.05,
            legend style={at={(0.5,-0.15)},
                anchor=north,legend columns=-1},
            ybar interval=0.7,
            width=\textwidth,
            ]
            \addplot table [col sep=comma,trim cells=true,y=height] {numericaltests/data/test.csv};

            \addplot[red,sharp plot,update limits=false]
                coordinates {(-1,1.00) (34,1.00)}
                node[above] at (axis cs:15,1.00) {};
            \legend{Ca2Fe2As2}
        \end{axis}
    \end{tikzpicture}
    \caption{Sequence}
    \label{fig:sequenceHeight}
\end{figure}

my test.csv file:

sequence,height
1,2.0
2,1.5
3,1.8
4,2.4

Barchart:

https://www.dropbox.com/s/j6rs7gtn5dyh6ia/Screenshot%202013-11-09%2011.14.14.png

migrated from stackoverflow.com Nov 17 '13 at 6:32

This question came from our site for professional and enthusiast programmers.

2

The problem is, that ybar interval requires a start and a end value. I changed it to ybar, then everything is fine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy