[R] not working yet: Re: lattice overlay

David Winsemius dwinsemius at comcast.net
Thu Jul 28 17:01:55 CEST 2011


On Jul 28, 2011, at 7:50 AM, Ram H. Sharma wrote:

> Hi Dieter and R community:
>
> I tried both of these three versions with ylim as suggested, none  
> work:  I
> am getting only single (pch = 16) not overlayed (pch =3) everytime.
>
> *vs 1*
>
> require(lattice)
>
> xyplot(Sepal.Length ~ Sepal.Width | Species , data= iris,
>
>  panel= function(x, y, subscripts) {
>
> panel.xyplot(x, y, pch=16, col = "green4", ylim = c(0, 10))
>
> panel.lmline(x, y, lty=4, col = "green4")
>
> panel.xyplot (iris$Petal.Length [subscripts],
> iris$Petal.Width[subscripts], pch= 3, col = "red")
>
> panel.lmline(iris$Petal.Length [subscripts], iris$Petal.Width
> [subscripts], col = "red")
>
> }, as.table=T, subscripts=T)
>
>
> *vs 2*
>
> require(lattice)
>
> xyplot(Sepal.Length ~ Sepal.Width | Species , data= iris,
>
>  panel= function(x, y, subscripts) {
>
> panel.xyplot(x, y, pch=16, col = "green4", ylim = c(0, 10))
>
> panel.lmline(x, y, lty=4, col = "green4")
>
>
> panel.xyplot (iris$Petal.Length [subscripts], iris 
> $Petal.Width[subscripts],
> pch= 3, col = "red", ylim = c(0,10)
>
> )
>
> panel.lmline(iris$Petal.Length [subscripts], iris$Petal.Width
> [subscripts], col = "red")
>
> }, as.table=T, subscripts=T)
>
>
>
> *vs 3*
>
> require(lattice)
>
> xyplot(Sepal.Length ~ Sepal.Width | Species , data= iris,
>
>  panel= function(x, y, subscripts) {
>
> panel.xyplot(x, y, pch=16, col = "green4")
>
> panel.lmline(x, y, lty=4, col = "green4")
>
>
> panel.xyplot (iris$Petal.Length [subscripts], iris 
> $Petal.Width[subscripts],
> pch= 3, col = "red", ylim= c(0,10)
>
> )
>
> panel.lmline(iris$Petal.Length [subscripts], iris$Petal.Width
> [subscripts], col = "red")
>
> }, as.table=T, subscripts=T)
>
> Help please:
>
>
> From: Dieter Menne <dieter.menne at menne-biomed.de>
>> Date: Wed, Jul 27, 2011 at 8:44 AM
>> Subject: Re: [R] lattice overlay
>> To: r-help at r-project.org
>>
>> Ram H. Sharma wrote:
>>>
>>> I want to overlay lattice scatter plot: I do not know why the  
>>> following
>>> code
>>> is not plotting subscripts ! Sorry if this question is too simple:
>>>
>>> Working example shortened:
>>>
>>> .....panel.xyplot(x, y, pch=16, col = "green4", ylim = c(0, 10))
>>>
>>>
>>
>> Because they are out of range. Put ylim outside the panel, and it  
>> works.
>>
>> Dieter

Please re-read the earlier advice, ... this time reading for meaning.

-- 
David.


David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list