Dear list, I have a two character vector with two different values in them (two each, that is). Naturally, when I use these vectors as grouping factors in a lattice plot, I get four panels. Now, one of the possible four combinations will never have data, so one panel will always be empty. So now my question is: can I force R / Lattice not to print it, and give me only the 3 filled panels? I have tried adding "layout=c(3,1)" to the list of arguments, but that gives me one plot that looks like I want it to, and then a new plot with just the empty panel. I use this in an odfWeave document, so just getting the last (empty) plot in the output is not really what I want. I do of course appreciate all the help I can get on this. /Fredrik -- "Life is like a trumpet - if you don't put anything into it, you don't get anything out of it."
Fredrik Karlsson wrote:> > Dear list, > > I have a two character vector with two different values in them (two > each, that is). Naturally, when I use these vectors as grouping > factors in a lattice plot, I get four panels. > Now, one of the possible four combinations will never have data, so > one panel will always be empty. So now my question is: can I force R / > Lattice not to print it, and give me only the 3 filled panels? > > I have tried adding "layout=c(3,1)" to the list of arguments, but that > gives me one plot that looks like I want it to, and then a new plot > with just the empty panel. I use this in an odfWeave document, so just > getting the last (empty) plot in the output is not really what I want. > > I do of course appreciate all the help I can get on this. > >One possibility would be to assign the factor interaction explicitly to a variable (mydata$interact = with(mydata,interaction(f1,f2)) or f1:f2) and group by the interaction (which will be missing the empty group) rather than by the two groups Ben Bolker -- View this message in context: http://www.nabble.com/Surpress-one-panel-in-lattice-plot..--tp25108072p25108944.html Sent from the R help mailing list archive at Nabble.com.
On Sun, Aug 23, 2009 at 5:41 PM, Ben Bolker<bolker at ufl.edu> wrote:> > > > Fredrik Karlsson wrote: >> >> Dear list, >> >> I have a two character vector with two different values in them (two >> each, that is). Naturally, when I use these vectors as grouping >> factors in a lattice plot, I get four panels. >> Now, one of the possible four combinations will never have data, so >> one panel will always be empty. So now my question is: can I force R / >> Lattice not to print it, and give me only the 3 filled panels? >> >> I have tried adding "layout=c(3,1)" to the list of arguments, but that >> gives me one plot that looks like I want it to, and then a new plot >> with just the empty panel. I use this in an odfWeave document, so just >> getting the last (empty) plot in the output is not really what I want. >> >> I do of course appreciate all the help I can get on this. >> >> > > One possibility would be to assign the factor interaction explicitly > to a variable ?(mydata$interact = with(mydata,interaction(f1,f2)) or f1:f2) > and group by the interaction (which > will be missing the empty group) rather than by the two groupsIn this case, another quick workaround would be to use layout=c(3,1,1), although that would not easily generalize. -Deepayan
Reasonably Related Threads
- Urgent - odfWeave produces graphs /images with Read-Error
- odfWeave : change of text style of output is ignored
- current.panel.limits() of lattice returning NaN limits - why?
- Groups in histograms?
- How do I get just the two last tokens of each string in a vector?