My current plotting tool for my papers is pgfplots for nice consistent plots. Now I would like to add a boxplot. Is this possible with help of pgfplots, or any helper package?
|
PGFPlots supports boxplots natively as of version 1.8 See Boxplot in latex for an example. The remainder of this answer should be considered obsolete. There is a much improved version of this code at Simpler boxplots in pgfplots - is this possible?. It allows creating box plots with a single command, and adds much more flexibility to the data format and the plot styles:
Original answer: Not out of the box, and you'd have to do the quantile calculations outside of PGFplots, but then you can draw box plots with a bit of style trickery. This code
can generate this plot
if
Here's a full compilable example:
|
|||||||||||
|
|
For every point more than 3/2 times the interquartile range from the end of a box, is a dot. The only special optional arguments, beside all other which are valid for drawing lines and filling areas, are IQLfactor, barwidth, and arrowlength, where the latter is a factor which is multiplied with the barwidth for the line ends. The IQLfactor, preset to 1.5, defines the area for the outliers. Run it with
|
|||||
|
|
If you use R, you can output the boxplot using tikzDevice. Here's an example:
|
||||
|
|
|
QtiPlot is a free program that can take your spreadsheet data and create a box plot with a consistent look. You can change the title, x-axis, etc., and then export the image into a .tex file thereby generating all the code from \begin{tikzpicture} to \end{tikzpicture}. Copy that code into your LaTeX document. Here is what I generated from some sample data. |
|||
|
|
|
I am not aware of any easy-to-use packages for producing box plots in |
|||
|
|





