[R] Modifications to an abline

Doran, Harold
2004-11-28T17:22:45Z

Dear List:

I am working to generate graphs for individual students that will be created
through a series of loops in Sweave. Before doing so, I am still trying to
design the graph. The code for creating the barplot is below with some sample
datapoints just made up for now.

Ultimately, this chart will take data from an lme object using longitudinal
student data. So, the dots represent the observed student scores at each
occasion and the abline will be added using the data from coef(), which gives
the intercept and slope for each individual student.

Now, the abline currently extends the entire graph, which I do not want exactly.
Assume I only have data at grades 1,2, and 3 for this individual. I would want
the abline to extend only as far as the observed data using a lty=1.

However, I want to show an extrapolated line from the current score to the end
of the graph. I want for this line to be dashed, something like lty=2.

So, while the abline should extend the length of the chart, I want for it to
change in style at a specified point. Can this be done? Last, I'm not sure I
want the abline to extend the entire region of the chart, but maybe say to the
middle of the barplot.

I would appreciate any thoughts on this. Any thoughts on code to improve the
chart is also appreciated.

Harold
Windows XP
ver 1.9

Grade1<-c(0,0,0,0)
Grade2<-c(0,0,0,0)
Grade3<-c(0,0,0,0)
Grade4<-c(0,0,0,0)
Grade5<-c(250,100,100,100)
foobar<-cbind(Grade1,Grade2,Grade3,Grade4,Grade5)
barplot(foobar,names=c("Grade 1", "Grade 2", "Grade
3", "Grade 4", "Grade 5"),
col=c("blue","green","yellow","red"),axis.lty=1)
legend(.3,550,legend=(c("Advanced",
"Proficient","Basic","Below Basic")),
fill=c("red","yellow","green","blue"))
abline(130,30)
points(1,103)
points(2,150)
points(3,300)

	[[alternative HTML version deleted]]