Re: [R] change fitted line colour in lme() trellis plot?

2006-01-20 Thread Bill Simpson
On Thu, 2006-01-19 at 16:21 -0600, Deepayan Sarkar wrote:
> On 1/19/06, Deepayan Sarkar <[EMAIL PROTECTED]> wrote:
> > On 1/19/06, Bill Simpson <[EMAIL PROTECTED]> wrote:
> > > If I used a groupedData object, if I do
> > > fit<-lme(blah)
> > > then
> > > plot(augPred(fit))
> > > produces a nice trellis plot of the data along with the fitted lines
> > >
> > > However I find that the lines and the data points are in the same colour
> > > (light blue against a medium grey background). Is there a way to make
> > > the lines in a different colour (e.g. black)?
> >
> > plot(augPred(fit), col.line = 'black')
> >
> > > It would also be nice if
> > > the line were plotted after the points so it is visible (I have a lot of
> > > points and the line is obscured).
> >
> > The order is hard-coded in the panel function:
> >
> > > plot(augPred(fit))$panel
> > function (x, y, subscripts, groups, ...)
> > {
> > if (grid)
> > panel.grid()
> > orig <- groups[subscripts] == "original"
> > panel.xyplot(x[orig], y[orig], ...)
> > panel.xyplot(x[!orig], y[!orig], ..., type = "l")
> > }
> 
> Actually, this is already what you want, so you shouldn't need to do anything.
Thanks very much Deepayan for your helpful replies.
The line in the plot is exactly how I want now (black and on top of the
points [by default, as you say -- I just couldn't see it because it was
same the colour as the points before])

Best wishes
Bill

__
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] change fitted line colour in lme() trellis plot?

2006-01-19 Thread Deepayan Sarkar
On 1/19/06, Deepayan Sarkar <[EMAIL PROTECTED]> wrote:
> On 1/19/06, Bill Simpson <[EMAIL PROTECTED]> wrote:
> > If I used a groupedData object, if I do
> > fit<-lme(blah)
> > then
> > plot(augPred(fit))
> > produces a nice trellis plot of the data along with the fitted lines
> >
> > However I find that the lines and the data points are in the same colour
> > (light blue against a medium grey background). Is there a way to make
> > the lines in a different colour (e.g. black)?
>
> plot(augPred(fit), col.line = 'black')
>
> > It would also be nice if
> > the line were plotted after the points so it is visible (I have a lot of
> > points and the line is obscured).
>
> The order is hard-coded in the panel function:
>
> > plot(augPred(fit))$panel
> function (x, y, subscripts, groups, ...)
> {
> if (grid)
> panel.grid()
> orig <- groups[subscripts] == "original"
> panel.xyplot(x[orig], y[orig], ...)
> panel.xyplot(x[!orig], y[!orig], ..., type = "l")
> }

Actually, this is already what you want, so you shouldn't need to do anything.

Deepayan

__
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] change fitted line colour in lme() trellis plot?

2006-01-19 Thread Deepayan Sarkar
On 1/19/06, Bill Simpson <[EMAIL PROTECTED]> wrote:
> If I used a groupedData object, if I do
> fit<-lme(blah)
> then
> plot(augPred(fit))
> produces a nice trellis plot of the data along with the fitted lines
>
> However I find that the lines and the data points are in the same colour
> (light blue against a medium grey background). Is there a way to make
> the lines in a different colour (e.g. black)?

plot(augPred(fit), col.line = 'black')

> It would also be nice if
> the line were plotted after the points so it is visible (I have a lot of
> points and the line is obscured).

The order is hard-coded in the panel function:

> plot(augPred(fit))$panel
function (x, y, subscripts, groups, ...)
{
if (grid)
panel.grid()
orig <- groups[subscripts] == "original"
panel.xyplot(x[orig], y[orig], ...)
panel.xyplot(x[!orig], y[!orig], ..., type = "l")
}

You can change it by supplying your own panel function, e.g.

plot(augPred(fit), col.line = "black",
 panel =
 function (x, y, subscripts, groups, ...) {
 panel.grid()
 orig <- groups[subscripts] == "original"
 panel.xyplot(x[orig], y[orig], ...)
 panel.xyplot(x[!orig], y[!orig], ..., type = "l")
 })

Deepayan

__
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] change fitted line colour in lme() trellis plot?

2006-01-19 Thread Bill Simpson
If I used a groupedData object, if I do 
fit<-lme(blah)
then
plot(augPred(fit))
produces a nice trellis plot of the data along with the fitted lines

However I find that the lines and the data points are in the same colour
(light blue against a medium grey background). Is there a way to make
the lines in a different colour (e.g. black)? It would also be nice if
the line were plotted after the points so it is visible (I have a lot of
points and the line is obscured).

I have looked at par().

Thanks very much for any help.

Bill

__
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html