Skip to content

Panel order in lattice with xyplot

2 messages · Carol, Dieter Menne

#
Dear all, 

I am a new user of R  ;-) (I started three months ago) and I am going very
slow?.
I am using lattice and am trying to draw a multipanel figure. The problems
are that I am not able to find out how to: 
1. Set the order of the panels.
2. Set the order of the x axes.
:rules:

The codes I am using are: 
 
Benthic<- read.table(file="WWTP 1 WICK 5.txt",header = TRUE)
library(lattice)
 xyplot(Concentration ~ Day | Pharmaceutical,
 layout = c (3,4),        
          scales = list(x = list(rot = 45)),
        groups= Month, data = Benthic,  main="Wick WWTP",
           xlab =  "Colection time (Days)",
        ylab = "Concentration (ng/L)",
      ylim= c(1000,-100),
       auto.key=list(space = "right"),# a?ade la leyenda
        par.settings = simpleTheme(pch=1:2),
        panel=function(x,y,...) {
 panel.superpose(x,y,...)
 panel.superpose(x,y,panel.groups="panel.lmline",...)})


Thanks in advance, 
Carol
1 day later
#
Carol wrote:
Never mind, R has s a steep (or, more accurately, shallow) learning curve.
Carol wrote:
For an easy, but restricted, way to change the order of the panels, see
as.table in the documentation of xyplot. To change the order panels with
categorical variable, it is easiest to change the order of the categories;
see, for example, "reorder".
Carol wrote:
Your example is fine, with the exception that other people cannot reproduce
it because they do not have the data file. So always include dummy data for
a detailed reply