Guy Forrester wrote:
Dear All,
Using Splus 6.0 on a Windows 2000 machine
I am having a problem with the trellis graphs using the code below
xyplot(hsi ~ wt | vehicle,
prepanel = function(x, y) prepanel.lmline,
xlab = "Weight", ylab = "HSI",
panel = function(x, y) {
panel.grid(h=0, v= 0)
panel.xyplot(x, y)
panel.abline(lm(hsi~wt,na.action=na.exclude))
},aspect = "xy")
There are 3 vehicles and the scatter plot for these turns out fine
however the fitted lines I ask for in the panel.abline it plots the
regression line for the first vehicle on all 3 plots.
Could anyone indicate how to stop this happening, the same thing happens
in the other not too dissimilar package.
Also in S-plus, but not the other package, one of the vertical axes is
not aligned properly on the graph, can this be remedied also
For the first problem, you need the to use
panel.abline(lm(y~x,na.action=na.exclude))
For the second problem, you might try looking at the scales argument,
though I'm not sure exactly what you're seeing.
Regards,
Sundar
|