Using pgfplots to make boxplots in LaTeX

Here’s an example:


\documentclass{article}
\usepackage{pgfplots}
\usepackage{filecontents}

\begin{filecontents}{testdata.dat}
0 1 1.2 0.4 1.5 0.2
1 2 2.3 1.5 2.7 1
2 0.7 1.4 0.5 1.9 0.1
\end{filecontents}

\pgfplotsset{
    box plot/.style={
        /pgfplots/.cd,
        black,
        only marks,
        mark=-,
        mark size=1em,
        /pgfplots/error bars/.cd,
        y dir=plus,
        y explicit,
    },
    box plot box/.style={
        /pgfplots/error bars/draw error bar/.code 2 args={%
            \draw  ##1 -- ++(1em,0pt) |- ##2 -- ++(-1em,0pt) |- ##1 -- cycle;
        },
        /pgfplots/table/.cd,
        y index=2,
        y error expr={\thisrowno{3}-\thisrowno{2}},
        /pgfplots/box plot
    },
    box plot top whisker/.style={
        /pgfplots/error bars/draw error bar/.code 2 args={%
            \pgfkeysgetvalue{/pgfplots/error bars/error mark}%
            {\pgfplotserrorbarsmark}%
            \pgfkeysgetvalue{/pgfplots/error bars/error mark options}%
            {\pgfplotserrorbarsmarkopts}%
            \path ##1 -- ##2;
        },
        /pgfplots/table/.cd,
        y index=4,
        y error expr={\thisrowno{2}-\thisrowno{4}},
        /pgfplots/box plot
    },
    box plot bottom whisker/.style={
        /pgfplots/error bars/draw error bar/.code 2 args={%
            \pgfkeysgetvalue{/pgfplots/error bars/error mark}%
            {\pgfplotserrorbarsmark}%
            \pgfkeysgetvalue{/pgfplots/error bars/error mark options}%
            {\pgfplotserrorbarsmarkopts}%
            \path ##1 -- ##2;
        },
        /pgfplots/table/.cd,
        y index=5,
        y error expr={\thisrowno{3}-\thisrowno{5}},
        /pgfplots/box plot
    },
    box plot median/.style={
        /pgfplots/box plot
    }
}

\begin{document}
\begin{tikzpicture}
\begin{axis} [enlarge x limits=0.5,xtick=data]
    \addplot [box plot median] table {testdata.dat};
    \addplot [box plot box] table {testdata.dat};
    \addplot [box plot top whisker] table {testdata.dat};
    \addplot [box plot bottom whisker] table {testdata.dat};
\end{axis}
\end{tikzpicture}
\end{document}
.

 

 

 

 

Sweave = R + LaTeX

Sweave é uma ferramenta útil para a elaboração de relatórios usando de forma inteligente as funcionalidades do R e LaTeX.

Alguns tutoriais

exemplo.pdf

Sweave-manual

Sweave-Rnews-2002-3

Sweave-Rnews-2003-2

LaTeX

Install LaTeX in Ubuntu:

$ sudo apt-get install texlive texlive-full gedit-latex-plugin texlive-fonts-recommended latex-beamer texpower texlive-pictures texlive-latex-extra texlive-science texlive-publishers

 

Some LaTeX editors

LeD  http://www.latexeditor.org/

TeXnicCenter http://www.texniccenter.org/

Texmaker http://www.xm1math.net/texmaker/

MeWa http://sourceforge.net/projects/mewa/

Winedt ftp://cam.ctan.org/tex-archive/systems/win32/winedt/winedt55.exe

TeXworks http://www.tug.org/texworks/

Kile http://kile.sourceforge.net/

LaTeXila http://projects.gnome.org/latexila/

Gummi http://dev.midnightcoding.org/projects/gummi?page_id=6

Comparison of LaTeX editors for different operating system

Symbols list:

http://web.ift.uib.no/Fysisk/Teori/KURS/WRK/TeX/symALL.html

Some commands to run:

dvi file: latex file_name.tex

pdf file: dvipdf file_name.dvi
or
pdflatex file_name.tex

Miscellaneous:

LaTeX no Gmail

http://alexeev.org/gmailtex.html

Online LaTeX editors

Verbosus http://www.verbosus.com/

ScribTeX http://scribtex.com/

http://sciencesoft.at/latex/flatex.gsp?lang=en

http://latex.informatik.uni-halle.de/latex-online/latex.php?spw=2&id=245466_PJ39QeUaDKIe

Online latex equations editor

http://www.numberempire.com/texequationeditor/equationeditor.php

http://rlehy.free.fr/

http://www.sciweavers.org/free-online-latex-equation-editor

http://www.codecogs.com/latex/eqneditor.php

Ebooks

http://getting-free-ebooks.blogspot.com/2011/04/latex-beginners-guide-free-download.html

http://www.freebookcentre.net/special-books-download/A-Beginners-Introduction-to-Typesetting-with-LaTeX-%28by-Peter-Flynn,-in-PDF%29.html

http://www.freebookcentre.net/special-books-download/A-Simplified-Introduction-to-LaTeX-%28Harvey-Greenberg%29.html

A não tão pequena introdução ao LaTeX

Introdução ao LATEX

Introdução ao Uso do Preparador de Documentos LaTeX

The Not So Short Introduction to LaTeX2e, or LaTeX2e in 133 minutes (2.21 MB pdf file)

LaTeX Primer A basic guide to LaTeX

The AMS Short Math Guide for LaTeX, a concise summary of math formula typesetting features

Text Processing using LaTeX

The (La)TeX encyclopaedia

LaTeX Tutorials: a Primer

Getting to Grips with LaTeX

http://www.maths.manchester.ac.uk/~kd/latextut/pdfbyex.htm

http://www.latextemplates.com/