Lesson 15: Visualizing Data I - Enhancing Scatter PlotsLesson 15: Visualizing Data I - Enhancing Scatter Plots
In this chapter we'll begin a somewhat more detailed examination of the graphical capabilities in R, and here we'll focus on scatterplots.
- Create a scatterplot with legend
- Create scientifically formatted axis labels
- Create multipanel plots
- Create plots with a secondary y-axis
The R code file and data files for this lesson can be found on the Essential R - Notes on learning R page.
15.1 - Basic Use of plot()15.1 - Basic Use of plot()
We've already used
plot(), but without much discussion of what it can do. Here we'll look a bit more at (some of) the features of
plot(). Note that there is a lot happening in the background when we call
plot() - a coordinates system is set up, default axis labels generated, and rang limits for the axes are selected.
15.2 - Introducing lines() and Formatting Axis Labels15.2 - Introducing lines() and Formatting Axis Labels
We can add any arbitrary line segements to a plot using
lines(), as we'll demonstrate here. We'll also look at how we can control the format of axis labels.
15.3a - Putting Together a Publication-Quality Scatter Plot15.3a - Putting Together a Publication-Quality Scatter Plot
Now we'll put together what we've done so far to create a polished plot.
15.3b - Introducing layout() for Multi-Panel Plots15.3b - Introducing layout() for Multi-Panel Plots
Here we'll introduce the function
layout() for creating multipanel plot layouts.
15.4 - Controlling Plot Dimensions - quartz() and x11()15.4 - Controlling Plot Dimensions - quartz() and x11()
When you are working on plots, you may want to control the size of the plotting window. This can be done using
quartz() to open a new graphical device whose size you can control.
15.5 - Creating a Finished Multi-Panel Plot - Part I15.5 - Creating a Finished Multi-Panel Plot - Part I
Now we'll put everything together to create a publication-quality multi-panel plot.
15.6 - Creating a Finished Multi-Panel Plot - Part II15.6 - Creating a Finished Multi-Panel Plot - Part II
This is a continuation of the last video on creating a multipanel plot.
15.7 - Using Loops for Multi-Panel Figures15.7 - Using Loops for Multi-Panel Figures
Here we'll consider if and when it would make sense to use a loop to create multipanel plot.
15.8 - Adding a Secondary y-axis15.8 - Adding a Secondary y-axis
We'll wind up this chapter with a demonstration of how to add a secondary y-axis to a plot.