I believe the problem could be that xyplot uses grid graphics and plot.new
and curve are base graphics functions and the 2 graphics systems (grid and
base) don't play nicely together without a little extra work.  In general
the gridBase package helps them play nicely, but I am not sure that it will
be the best approach in your case.  I would look at rewriting the effects
of curve in a panel function for xyplot using the llines function (notice
the 2 'l's at the front) or using only base graphics.


On Wed, Jan 9, 2013 at 9:57 AM, Elisabeth Van Beveren <elisvb@hotmail.com>wrote:

> Hey,
>
> I'm stuck on something I already did before (just a different kind of
> database), and whatever I try, it doesn't work anymore. So thanks for your
> help.
>
> Here's how my data approximately looks like:
>
> year       season replicate              size        freq       weight
>
> 2000      summer              ch1         6             1             45
>
> 2000      summer              ch1         6.5          12           46
>
> 2000      summer              ch1         7             33           470
>
>
>
> I have 2 years (2000 and 2001) and 2 seizons (winter and summer). I wanted
> to plot weight~size, with 2 groups (year and seizon), so here's my
> shortened
> script for that:
>
> database$groups=paste(database$seizon,database2$year,sep=" ")
>
> xyplot(database$weight~database2$size,
>
>     groups=database$groups,
>
>
> par.settings=list(superpose.symbol=list(col=col.list,pch=c(21,16,21,16))),
>
>     auto.key=list(corner=c(0.1,0.9),lines=F,points=T))
>
> Which works fine, the problem comes when I try to add 2 exponential curves
> to the data (the 2 seizons). I tried this:
>
> summ=subset(database,seizon=="summer")
>
> modsumm=nls(summ$weight~exp(a+b*summ$size), data=summ, start=list(a=0,b=0))
>
> exposumm=curve(exp(0.05354+0.19872*x), from=0, to=22, add=T, lwd=1,
> col="blue",lty=1)
>
> After having to add plot.new() in the front, the line does or not show up,
> or shows up but wrongly placed. I thought this might be because of the
> subset, so I wanted to do something like this:
>
> modsumm=nls(weight~exp(a+b* size), data=engsAGG2[seizon=="summer"],
> start=list(a=0,b=0))
>
> which returns: "undefined columns selected"
>
> Thanks in advance for the reply.
>
>
>
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@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.
>



-- 
Gregory (Greg) L. Snow Ph.D.
538280@gmail.com

	[[alternative HTML version deleted]]


