Plot templates provide a convenient way of wrapping a number of operations to produce a complex plot. They are good sources of example code if you want to make your own wrapper function to produce a particular type of plot. Most of these templates are far from complete, and I'd be particularly keen to get your feedback on them.
This page illustrates each of the five templates and why you might want to use them. Please see the documentation for more options and examples.
These templates have been designed principally to aid data checking and cleaning.
A fluctuation diagram is a type of mosaic plot, and is useful for visualising tabular data. The current version only deals with two-way tables, but I hope to extend it in the future. You can also use it to produce heatmaps, but comparing a heatmap to a fluctuation diagram should hopefully illustrate why heatmaps are not a good idea.
> ggfluctuation(xtabs(Freq ~ Survived + Class, Titanic))![]()
Inspired by the missing value plot of Manet and Mondrian, this plot lets you quickly find out which variables have missing values.
NULLThe parallel coordinates plot is a way of visualising high-dimensional data where the axes are arranged in parallel. In this plot template, the data is reshaped reshaping and then default aesthetics set to y-axis = value, x-axis = variable, and id = row number. This plot template does not add any grobs by default, so you will need to do that yourself. ggline will produce the most traditional PCP, but you might want to experiment with others (eg. ggboxplot or ggquantiles), especially if you have a lot of overplotting. Note that an interactive parallel coordinates plot is far more useful than the static version: you might want to look at GGobi's implementation
> ggline(ggpcp(mtcars))![]()
A structure plot is very similar to the parallel coordinates plot, in that it is based on the same view of the data. It presents all data points in one image, and I think might be useful for detecting gross structural problems in the data.
> ggstructure(mtcars)> ggstructure(mtcars, scale = "var")
![]()
The order plot lets you investigate if there is any structure in the way that the data was recorded. The order plot is a series of line plots (one for each variable) plotting value against row index. Patterns in the plots may indicate properties of the underlying data collection process
> ggorder(mtcars[, 1:3])![]()