This recipe describes how to make scatter plots using some very simple commands. We'll go from a single line of code, which makes a scatter plot from pre-loaded data, to a script of a few lines that produces a scatter plot customized with colors, titles, and axes limits specified by us.
All you need to do to get started is start R. You should have the R prompt on your screen as shown in the following screenshot:
Let's use one of R's inbuilt datasets called
cars to look at the relationship between the speed of cars and the distances taken to stop (recorded in the 1920s).
To make your first scatter plot, ...