Figure Legends

For some plots it might be necessary to add a legend. This can be placed inside or outside the actual plot. The format of a legend can be:

# place legend at x,y where these coordinates are derived from the graph
legend(x=tmp.u[1], y=tmp.u[4], legend=list("Scan Series One - Trial One","Scan Series One - Trial
+Two", "Scan Series Two - Trial One", "Scan Series Two - Trial Two", "Scan Series Three - Trial
+One", "Scan Series Three - Trial Two"), pch=c(7,9,15,16,17,18))

# break the above legend into two pieces and place outside the graph
legend(x=0.0, y=54.14, legend=list("Scan Series One - Trial One","Scan Series One - Trial Two",
+"Scan Series Two - Trial One"), pch=c(7,9,15))
legend(x=8.0, y=54.14, legend=list("Scan Series Two - Trial Two", "Scan Series Three - Trial One",
+"Scan Series Three - Trial Two"), pch=c(16,17,18))

# place the legend at an interactive point
# locator reads the position of the graphics cursor when the (first) mouse button is pressed
legend(locator(), legend=list("Scan Series One - Trial One","Scan Series One - Trial Two", "Scan
+Series Two - Trial One", "Scan Series Two - Trial Two", "Scan Series Three - Trial One", "Scan
+Series Three - Trial Two"), pch=c(7,9,15,16,17,18))

# use lines and points in graph and indicate which is which:
legend(x=0.01, y = 0.89, legend=list("Scan Series Two - Trial One", "Scan Series Two - Trial Two",
+"Scan Series Three - +Trial One", "Scan Series Three - Trial Two", "Expected","Expected + 0.10
+mm","Expected - 0.10 mm"), lty=c(-1,-1,-1,-1,1,2,3), pch=c(15,16,17,18,-1,-1,-1)

Transcript

Now, if you want to add figure legends, so that we don't have to say somewhere else, "okay, which one of these is which figure", we can place them in different positions.  We can use different symbols.  We can put them outside of the graph.