[R] problem with abline

Gerard Smits g_smits at verizon.net
Thu Oct 7 01:31:19 CEST 2010


Hi David,

Just changed to the standard plot from xyplot and it worked fine.  I'll check out panel.lmline.

Thanks for your help.

Gerard


On Oct 6, 2010, at 3:27 PM, David Winsemius wrote:

> 
> On Oct 6, 2010, at 5:56 PM, Gerard Smits wrote:
> 
>> Hi All,
>> 
>> I am running a scatter plot and trying to add a best fit line.  I use an abline function, but get no line drawn over the points.
> 
> xyplot is Lattice
> abline is base graphics
> 
>> I also get no error.  I arm using V 2.10.0 on Windows 7.
>> 
>> Here is my code, including the SAS transport file import:
> 
> Nope. Read the Posting Guide about attachments to the list. Nice try, though.
> 
>> 
>> require (foreign)
>> require (chron)
>> require (Hmisc)
>> require (lattice)
>> 
>> clin  <- sasxport.get("y:\\temp\\subset.xpt")
>> attach(clin)
>> 
>> 
>> plot.new()
>> xyplot(jitter(b.lvef)~jitter(log.fgf),
>>      main="Scatter Plot of Baseline Ejection Fraction\nby Log10 FGF-23",
>>      ylim=c(10,90),
>>      ylab="Ejection Fraction", xlab="Log10 FGF-23")
> 
> Instead consider:
> ?panel.lmline
> 
> Perhaps (untested in absence of data):
> 
> plot.new()
> xyplot(jitter(b.lvef)~jitter(log.fgf), panel = function(x, y) {
>          panel.xyplot(x, y)
>           panel.lmline(x,y)
>       },
>      main="Scatter Plot of Baseline Ejection Fraction\nby Log10 FGF-23",
>      ylim=c(10,90),
>      ylab="Ejection Fraction", xlab="Log10 FGF-23")
> 
> 
>> 
>> abline(lm(b.lvef~log.fgf))
>> 
>> Any suggestions appreciated.
>> 
>> Thanks,
>> 
>> Gerard
>> 	[[alternative HTML version deleted]]
>> 
> 
> David Winsemius, MD
> West Hartford, CT
> 



More information about the R-help mailing list