Plot three lines in one figure

In this example, I will plot three lines in one figure as shown in class.

active<-read.table('http://nd.psychstat.org/_media/classdata/active.txt', header=T, na.string='99999')
plot(1:4, active[5,9:12], type='o', lty=1, col='black', ylim=c(0,40), xlab='Time',ylab='HVLTT')
lines(1:4, active[10,9:12], type='o', lty=2, col='red')
lines(1:4, active[15,9:12], type='o', lty=3, col='blue')
legend('bottomleft', c('5th', '10th', '15th'), lty=c(1,2,3), col=c('black', 'red', 'blue'))

In the codes, the function plot() generates a new figure and the function lines() adds a figure to an existing figure. In both plot() and lines(), the meaning of the arguments is given below.

The function legend() can be used to add legends to plots. The commonly used options for the function are

This is the plot. threelinesplot.jpg