Chapter 11

More About Graphs

What You Will Learn In This Chapter:

  • How to add error bars to existing graphs
  • How to add legends to plots
  • How to add text to graphs, including superscripts and subscripts
  • How to add mathematical symbols to text on graphs
  • How to add additional points to existing graphs
  • How to add lines to graphs, including mathematical expressions
  • How to plot multiple series on a graph
  • How to draw multiple graphs in one window
  • How to export graphs to graphics files and other programs

Previously, you saw how to make a variety of graphs. These graphs were used to illustrate various results (for example, scatter plots and box-whisker plots) and also to visualize data (for example, histograms and density plots). It is important to be able to create effective graphs because they help you to summarize results for others to see, as well as being useful diagnostic tools. The methods you learned previously will enable you to create many types of useful graphs, but there are many additional commands that can elevate your graphs above the merely adequate.

In this chapter you look at fine-tuning your plots, adding new elements, and generally increasing your graphical capabilities. You start by looking at adding various elements to existing plots, like error bars, legends, and marginal text. Later you see how to create a new type of graph, enabling you to plot multiple series on one chart.

Adding Elements to Existing Plots

Once you have a basic graph of some sort, you will often ...

Get Beginning R: The Statistical Programming Language 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.