How to Describe the Center of Continuous Data in R
How to Use Dimensions to Extract Values from an Array in R
How to Work With Dates in R

Base, Grid, and Lattice Graphics in R

Perhaps confusingly, the standard distribution of R actually contains three different graphics packages. Once understood, these tools will greatly enhance the impact of your work in R.

  • Base graphics is the graphics system that was originally developed for R. The workhorse function of base graphics is a plot(). The code for base graphics is in the graphics package, which is loaded by default when you start R.

  • Grid graphics is an alternative graphics system that was later added to R. The big difference between grid and the original base graphics system is that grid allows for the creation of multiple regions, called viewports, on a single graphics page.

    Grid is a framework of code and doesn't, by itself, create complete charts. The author of grid, Paul Murrell, describes some of the ideas behind grid graphics on his website.

    The grid package needs to be loaded before you can use it.

  • Lattice is a graphics system that specifically implements the idea of Trellis graphics (or faceted graphics), which was originally developed for the languages S and S-Plus at Bell Labs. Lattice graphics in R make use of grid graphics.

    This means that the functions for creating graphics and changing options in base and lattice are mostly incompatible with one another.

    The lattice package needs to be loaded before use.

  • Add a Comment
  • Print
  • Share
blog comments powered by Disqus
How to Create Subgroups of Data in R
How to Sort and Order Data in R
How to Debug Your Code in R
How to Plot Histograms with Your Data in R
How to Take Samples from Data in R