O'Reilly logo

Beginning R: The Statistical Programming Language by Mark Gardener

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required