s-news
[Top] [All Lists]

Re: trellis graphs

To: Guy Forrester <ForresterG@landcareresearch.co.nz>
Subject: Re: trellis graphs
From: Sundar Dorai-Raj <sundar.dorai-raj@pdf.com>
Date: Fri, 23 May 2003 07:16:33 -0500
Cc: s-news@lists.biostat.wustl.edu
Organization: PDF Solutions, Inc.
References: <sece5337.070@Iris.lincoln.landcareresearch.co.nz>
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0.2) Gecko/20021120 Netscape/7.01


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


<Prev in Thread] Current Thread [Next in Thread>
  • trellis graphs, Guy Forrester
    • Re: trellis graphs, Sundar Dorai-Raj <=