Chapter 6

The grid Graphics Model

Chapter preview

This chapter describes the fundamental tools that grid provides for drawing graphical scenes (including plots). There are basic features such as functions for drawing lines, rectangles, and text, together with more sophisticated and powerful concepts such as viewports, layouts, and units, which allow basic output to be located and sized in very flexible ways.

This chapter is useful for drawing a wide variety of pictures, including statistical plots from scratch, and for adding output to plots created by lattice or ggplot2.

The functions that make up the grid graphics system are provided in an extension package called grid. The grid system is loaded into R as follows.

> library(grid)

In addition ...

Get R Graphics, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.