Figure 5-5: A Pairs Plot

Portfolio Categories: All Graphics and SGR Book Graphics.

fig-5-5-pairs plot


myX = c(1, 5, 19, 7, 6, 18, 11, 10)    # Create an x variable
myY = c(4, 3, 12, 7, 8, 9, 15, 9)      # Create a y variable
myZ = c(3, 9, 12, 2, 2, 17, 1, 8)      # Add z variable to x & y from sect 5.5
myData = data.frame(myX, myY, myZ)     # Combine x,y,z into data frame 

png(filename = "illustrations/fig-5-5-pairs plot.png",
  units = "in",                        # Set measurements in inches
  res = 1200,                          # Set resolution at 1200dpi
  width = 6,                           # Width at 6 inches
  height = 4)                          # Height at 4 inches

par(mai = c(1, 1, .25, .25))           # Set margins - no Title

pairs(myData)                          # Pairs plot for data frame

dev.off()                              # Output png file