[R] Help with adding points to allEffects plot

Peter Ehlers ehlers at ucalgary.ca
Tue Mar 9 18:35:00 CET 2010


As you can see on ?effects help page, plot.eff() uses
lattice graphics. You can't mix those with traditional
graphics commands. This should work:

  plot(allEffects(GSMOD), ask=FALSE)
  trellis.focus("panel", 1, 1)
    panel.points(y, x)
  trellis.unfocus()

  -Peter Ehlers

On 2010-03-09 9:37, Grant Gillis wrote:
> Thanks in advance for any help.
>
> I am attempting to add points to a plot using the allEffects command in the
> effects package.  When I try to add the points I get the following error
> message:
>
> Error in plot.xy(xy.coords(x, y), type = type, ...) :
>    plot.new has not been called yet
>
> Strangely, using the code I've pasted below this has worked for me in the
> past however figuring out what has changed has proved to be beyond me.
>
> Cheers,
>
> Grant
>
>> y<-c(1,3,2,4,5)
>> x<-c(1,2,3,4,5)
>>
>>
>> GSMOD<-lm(y~x)
>>
>> plot(allEffects(GSMOD), ask=F)
>> points(y, x)
> Error in plot.xy(xy.coords(x, y), type = type, ...) :
>    plot.new has not been called yet
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>

-- 
Peter Ehlers
University of Calgary



More information about the R-help mailing list