Hello everyone, I am ploting a groupeddata object with formula: formula(mydatausegroup) BF ~ HO | ID/Infar/Day Using this command: plot(na.omit(mydatausegroup), displayLevel=2,layout=c(10,2),aspect=2) This trellis plot does almost what I want and produces a 10x2 trellis plot, each panel is labeled as ID/Infar where infarct is either 1 or 0. And in each panel, it plots BF vs HO for each Day. However, the "days" are labeled simply as "1,2,3,4" instead of their actual values (ranging from 1 to 8). This just mapped for each ID the "1 st measurement, 2nd measurement, 3rd measurement, 4th measurement". How can I get this trellis plot to use 8 different colors and label them correct? Thanks, Turgut
On 11/17/06, Turgut Durduran <durduran at yahoo.com> wrote:> Hello everyone, > > I am ploting a groupeddata object with formula: > > formula(mydatausegroup) > BF ~ HO | ID/Infar/Day > > Using this command: > plot(na.omit(mydatausegroup), displayLevel=2,layout=c(10,2),aspect=2) > > > This trellis plot does almost what I want and produces a 10x2 trellis plot, each panel is labeled > as ID/Infar where infarct is either 1 or 0. And in each panel, it plots BF vs HO for each Day. However, the "days" are labeled simply as "1,2,3,4" instead of their actual values (ranging from 1 to 8). This just mapped for each ID the "1 st measurement, 2nd measurement, 3rd measurement, 4th measurement". > > How can I get this trellis plot to use 8 different colors and label them correct?Hard to say without a reproducible example. As the footer of every r-help message says: PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -Deepayan
On 11/17/06, Turgut Durduran <durduran at yahoo.com> wrote:>> Hello everyone, >> >> I am ploting a groupeddata object with formula: >> >> formula(mydatausegroup) >> BF ~ HO | ID/Infar/Day >> >> Using this command: >> plot(na.omit(mydatausegroup), displayLevel=2,layout=c(10,2),aspect=2) >> >> >> This trellis plot does almost what I want and produces a 10x2 trellis plot, each panel is labeled >> as ID/Infar where infarct is either 1 or 0. And in each panel, it plots BF vs HO for each Day. However, the "days" are labeled simply as "1,2,3,4" i>>nstead of their actual values (ranging from 1 to 8). This just mapped for each ID the "1 st measurement, 2nd measurement, 3rd measurement, 4th >>measurement". >> >> How can I get this trellis plot to use 8 different colors and label them correct?>Hard to say without a reproducible example. As the footer of every >r-help message says:>PLEASE do read the posting guide http://www.R-project.org/posting-guide.html >and provide commented, minimal, self-contained, reproducible code.>-DeepayanI apologize, I thought my example was fairly self-contained. I am attaching a sample data table (a subset). This is the code: library(nlme) library(lattice) tst <- read.table("sil.txt",header=TRUE) mydatausegroup <- groupedData( BF ~ HO | ID/Infa/Day, data=tst) plot(na.omit(mydatausegroup), displayLevel=2,layout=c(10,2),aspect=2)> min(mydatausegroup$Day)[1] 8> min(mydatausegroup$Day)[1] 1 Note that layout is too large now, but that does not matter. Thanks, Turgut ____________________________________________________________________________________ Sponsored Link Mortgage rates near 39yr lows. $310k for $999/mo. Calculate new payment! www.LowerMyBills.com/lre -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: sil.txt Url: https://stat.ethz.ch/pipermail/r-help/attachments/20061117/c9c15d91/attachment.txt
----- Original Message ---- From: Deepayan Sarkar <deepayan.sarkar at gmail.com> To: Turgut Durduran <durduran at yahoo.com> Cc: r-help at stat.math.ethz.ch Sent: Saturday, November 18, 2006 4:28:03 PM Subject: Re: Re: [R] Trellis Plot Labels On 11/17/06, Deepayan Sarkar <deepayan.sarkar at gmail.com> wrote:> On 11/17/06, Turgut Durduran <durduran at yahoo.com> wrote: > > On 11/17/06, Turgut Durduran <durduran at yahoo.com> wrote: > > >> Hello everyone, > > >> > > >> I am ploting a groupeddata object with formula: > > >> > > >> formula(mydatausegroup) > > >> BF ~ HO | ID/Infar/Day > > >> > > >> Using this command: > > >> plot(na.omit(mydatausegroup), displayLevel=2,layout=c(10,2),aspect=2) > > >> > > >> > > >> This trellis plot does almost what I want and produces a 10x2 trellis plot, each panel is labeled > > >> as ID/Infar where infarct is either 1 or 0. And in each panel, it plots BF vs HO for each Day. However, the "days" are labeled simply as "1,2,3,4" i>>nstead of their actual values (ranging from 1 to 8). This just mapped for each ID the "1 st measurement, 2nd measurement, 3rd measurement, 4th >>measurement". > > >> > > This seems to be intended behaviour, and the responsible function is > collapse.groupedData (which is not very transparent to me). > > > >> How can I get this trellis plot to use 8 different colors and label them correct? > > I don't see a documented way, so you'll probably need to modify > collapse.groupedData>>I should have added: it's of course fairly easy if you use xyplot directly.Thank you very much for your detailed help. However, in xyplot, I am ending up a whole bunch of empty panels corresponding to missing days. For example if I did: xyplot(CBF~OB|Day*Inf*ID,data=na.omit(mydatausegroup)) I must be misunderstanding the xyplot again. Turgut