I'm looking to add boxplots to my document. I know there are already working examples out there, including on this site, but I was curious if I could get the bare minimum simplest example to run. The plots I actually want to add shouldn't even be too much more complicated; I'll just need to put multiple boxes and whiskers alongside each other, and possibly resize if the plot turns out too large.
Here's what I have now:
\documentclass[11pt]{amsart}
\usepackage{tikz}
\usepackage{pgfplots}
\usepgfplotslibrary{statistics}
\begin{document}
\begin{tikzpicture}
\begin{axis}
\addplot [boxplot]
{1,2,3,4,5};
\end{axis}
\end{tikzpicture}
\end{document}
I get an error on the line after \end{tikzpicture} saying: Paragraph ended before \pgfflt@readlowlevelfloat was complete.
I'm curious what this error means, and what's missing from the code.
Edit: Quoting directly from the pgfplots manual page 505:
Data points can be given by means of any supported input stream, although the most useful ones are probably \addplot table and \addplot coordinates.
This makes me curious what all of the supported input streams are, and why a simple listing wasn't included as one of them.
Anyway, I tried the two listed in this quote. Replacing the line {1,2,3,4,5};
with
coordinates {(1),(2),(3),(4),(5)};
or
coordinates {(1,1),(2,2),(3,3),(4,4),(5,5)};
(just in case coordinates must have length at least 2)
yields the error message: Sorry, I could not read the plot coordinates near ',(3),(4),(5)' for the first, and similarly for the second. What is wrong with those lines?
On the other hand, replacing it with
table [row sep=\\,y index=0] {data\\ 1\\ 2\\ 3\\ 4\\ 5};
yields the error message: File ended while scanning use of \pgfplotstableread@loop@next. So something is still wrong here? I'm also curious about row sep=\\
and y index=0
; it seems removing either leads to a different error.
\begin{document}
and\end{document}
, you need to feed\addplot
with something it can parse, such as a function, a table or a set of cooridates. This list of integers does not seem to be a format which can be parsed by PGF. Maybe have a look at the manual?\addplot [boxplot] table [row sep=\\, y index=0] { data \\ 1 \\ 2 \\ 3 \\ 4 \\ 5 \\ };
. You don't need to read all of the manual, just the parts you need. As for\pgfflt@readlowlevelfloat
, it is an internal helper macro for PGFs handling of floating numbers. You can read more about this in the PGF manual in chapter 56, but it is really not that important to understand this.