# Grammar of Graphics

### Example 9.17: (much) better pairs plots

December 6, 2011 |

Pairs plots (section 5.1.17) are a useful way of displaying the pairwise relations between variables in a dataset. But the default display is unsatisfactory when the variables aren't all continuous. In this entry, we discuss ways to improve these dis...

### Plotting Time Series data using ggplot2

September 30, 2010 |

There are various ways to plot data that is represented by a time series in R. The ggplot2 package has scales that can handle dates reasonably easily. Fast Tube by Casper As an example consider a data set on the number of views of the you tube channel ramstatvid. A ...

### Charting the performance of cricket all-rounders – IT Botham

August 16, 2010 |

Cricket is a sport that generates a large volume of performance data and corresponding debate about the relative qualities of various players over their careers and in relation to their contemporaries. The cricinfo website has an extensive database of statistics for professional cricketers that can be searched to access the ... [Read more...]

### Displaying data using level plots

May 3, 2010 |

A level plot is a type of graph that is used to display a surface in two rather than three dimensions – the surface is viewed from above as if we were looking straight down and is an alternative to a contour plot – geographic data is an example of where this ...

### Summarising data using box and whisker plots

April 25, 2010 |

A box and whisker plot is a type of graphical display that can be used to summarise a set of data based on the five number summary of this data. The summary statistics used to create a box and whisker plot are the median of the data, the lower and ...

### Summarising data using scatter plots

April 18, 2010 |

A scatter plot is a graph used to investigate the relationship between two variables in a data set. The x and y axes are used for the values of the two variables and a symbol on the graph represents the combination for each pair of values in the data set. ...

### Summarising data using histograms

April 11, 2010 |

The histogram is a standard type of graphic used to summarise univariate data where the range of values in the data set is divided into regions and a bar (usually vertical) is plotted in each of these regions with height proportional to the frequency of observations in that region. In ... [Read more...]

### Summarising data using dot plots

March 26, 2010 |

A dot plot is a type of display that compares counts, frequencies, totals or other summary measures for a series of categories. The dot plot can be arranged with the categories either on the vertical or horizontal axis of the display to allow comparising between the different categories as well ... [Read more...]

### Two-way Analysis of Variance (ANOVA)

February 15, 2010 |

The analysis of variance (ANOVA) model can be extended from making a comparison between multiple groups to take into account additional factors in an experiment. The simplest extension is from one-way to two-way ANOVA where a second factor is included in the model as well as a potential interaction between ...

### Eight R Video Tutorials on VCASMO

February 4, 2010 |

Download "Getting Started with the Social Media Analytics Research Toolkit" (pdf, 1.25 megabytes) Download the Social Media Analytics Research Toolkit Thanks to Drew Conway (@drewconway), a PhD student at New York University, there are now eight excell... [Read more...]

### One-way Analysis of Variance (ANOVA)

February 3, 2010 |

Analysis of Variance (ANOVA) is a commonly used statistical technique for investigating data by comparing the means of subsets of the data. The base case is the one-way ANOVA which is an extension of two-sample t test for independent groups covering situations where there are more than two groups being ...

### The Grammar of Graphics: ggplot2 package

December 14, 2009 |

The grammar of graphics approach to constructing graphs has been implemented in the ggplot2 package in R. The author of the package, Hadley Wickham, has provided a website with many details of using the system to create nice looking graphics. The package removes many of the awkward parts of setting ... [Read more...]

### Summarising data using bar charts

December 12, 2009 |

A bar graph is a frequently used type of display that compares counts, frequencies, totals or other summary measures for a series of categories, e.g. sales in different market sectors or in quarters in a financial year. The bar graph can be laid out with the categories either on ... [Read more...]

### Graph Examples from Visualizing Data by William Cleveland

November 12, 2009 |

The trellis graphics approach was pioneered by various statistical researchers and the ideas are used extensively in the book “Visualizing Data” by William Cleveland. There are various resources on the website for trellis graphics including S code for creating the majority of the graphs that appear in the book. Inspired ... [Read more...]

### Using Faceting in ggplot2 to create Trellis-like Plots

November 9, 2009 |

One of the main strengths of the Trellis graphics paradigm is the use of panelling to divide data into subsets to investigate whether patterns are consistent as the conditioning variables change. In the ggplot2 package the terminology for specifying these separate panels is faceting and can be used to create ... [Read more...]

### Creating scatter plots using ggplot2

November 6, 2009 |

The ggplot2 package can be used as an alternative to lattice for producing high quality graphics in R. The package provides a framework and hopefully simple interface to producing graphs and is inspired by the grammar of graphics. The main function for producing graphs in this package is qplot, which ... [Read more...]