Figure 5-3: A Default Scatterplot

Portfolio Categories: All Graphics and SGR Book Graphics.

fig-5-3-basic scatterplot


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

png(filename = "illustrations/fig-5-3-basic scatterplot.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

plot(myX, myY)                         # Simple scatterplot of x & y

dev.off()                              # Output png file