[R] Adding abline in Lattice graph
Sundar Dorai-Raj
sdorairaj at gmail.com
Fri Feb 13 01:21:45 CET 2009
Sorry, that was my lack of understanding on how coplot works. Try the following:
coplot(lbxglu~lbxgh|eth, data = reg.dat.5,
panel= function(...) {
panel.smooth(...)
abline(h = 126, col = "red")
abline(v = 6.5, col = "blue")
},
xlab="ABC", ylab="FBG")
On Thu, Feb 12, 2009 at 3:49 PM, Sundar Dorai-Raj <sdorairaj at gmail.com> wrote:
> Try:
>
> coplot(lbxglu~lbxgh|eth, data = reg.dat.5,
> panel= function(...) {
> panel.smooth(...)
> panel.abline(h = 126, col = "red")
> panel.abline(v = 6.5, col = "blue")
> },
> xlab="ABC", ylab="FBG")
>
> Also note that you removed your "with" call and give coplot a data argument.
>
> HTH,
>
> --sundar
>
> On Thu, Feb 12, 2009 at 3:41 PM, Veerappa Chetty <chettyvk at gmail.com> wrote:
>> Hi,I would like add a horizontal line at 126 (col=red) and a vertical line
>> at 6.5 ( col= blue) in each panel .How should I use the panel.abline
>> function in the following code I am using:
>> ------------------
>> library(lattice)
>> with(reg.dat.5,coplot(lbxglu~lbxgh|eth,panel=panel.smooth,xlab="ABC",
>> ylab="FBG"))
>> ----------------------------------------
>> Thanks a lot.
>>
>> Professor of Family Medicine
>> Boston University
>> Tel: 617-414-6221, Fax:617-414-3345
>> emails: chettyvk at gmail.com,vchetty at bu.edu
>>
>> [[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.
>>
>
More information about the R-help
mailing list