**Software for Exploratory Data Analysis and Statistical Modelling**, and kindly contributed to R-bloggers)

The **pgf** drawing package for **LaTeX** provides facilities for drawing simple of complicated pictures within a **LaTeX** document. There are many options available within the package and in this post we consider some of the basics to get up and running.

Fast Tube by Casper

As with all LaTeX documents we need to select a document class and include some preamble material prior to the body of our document. A blank template for a document with a single tikz picture is shown here:

\documentclass{article} \usepackage{tikz} \begin{document} \pagestyle{empty} \begin{tikzpicture} ... \end{tikzpicture} \end{document}

The tikz picture has a coordinate system similar to that which you would expect where moving from left to right on the page corresponds to increasing the x value and bottom to top increases the y value. A line can be drawn between two points wit the **\draw** command:

`\draw (0,0) -- (1,0);`

To draw a line between multiple points these can be chained together in a single draw command:

`\draw (0,0) -- (1,0) -- (1, 4);`

The line style can be altered by adding various options in square brackets directly after the draw command. So to change to a dashed red line we would write the following code:

\draw[red,dashed] (0,0) -- (2,0);

A circle of a given radius can be draw using the **\draw** command and we specify the radius of the circle in round brackets:

`\draw (0,0) circle (2.5cm);`

This will draw a circle with radius of 2.5 cm. The circle could be changed into an ellipse and we would then need to specify the radius in two directions, an example of this:

`\draw (0,0) ellipse (2cm and 3.5cm);`

Other useful resources are provided on the Supplementary Material page.

**leave a comment**for the author, please follow the link and comment on their blog:

**Software for Exploratory Data Analysis and Statistical Modelling**.

R-bloggers.com offers

**daily e-mail updates**about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...