I am creating a few dozen multi-panel time series plots using lattice graphics in the lme4 package. Each panel in a given plot represents a tree. each multipanel plot is a particular treatment. Here's my issue: when you use xyplot() to plot this data it orders the panels alphabetically. I would prefer to have them in order of increasing slope of the regression line plotted in each panel. I've read everything I can find regarding the index.cond argument, and the best I can come up with is to manually order them to have the correct increasing slope order, i.e. index.cond=c(7,6,23,4,15,8,...). This would take inordinate amounts of time and I'm sure there is a better, more eloquent solution. Please help!

Sorry for the long dataset below, I'm unsure of how to create a reproducible example otherwise.

example.plot = xyplot(ht ~ time|tree, data=data,
                type = c("r", "g", "p"),
                par.settings=simpleTheme(col="blue"),
             main="abc",
             )
example.plot
data=
   tree treat site plot rx mr rxl t w     l spp time  dia    ht
1       1     1  C-H 2002  1  1  Mn N N 14.55  ac    1  9.6  74.5
2       2     1  C-H 2002  1  1  Mn N N 14.55  ac    1  7.4  69.5
3       3     1  C-H 2003  1  1  Mn N N 13.34  ac    1  6.0  66.7
4       4     1  C-H 2003  1  1  Mn N N 13.34  ac    1  7.1  75.4
5       5     1  C-H 2003  1  1  Mn N N 13.34  ac    1  7.5  57.5
6       6     1  C-H 2008  2  1  Mc N N 11.63  ac    1  5.7  71.5
7       7     1  C-H 2008  2  1  Mc N N 11.63  ac    1  5.2  50.0
8       8     1  C-H 2011  2  1  Mc N N 13.04  ac    1  6.3  62.0
9       9     1  C-H 2011  2  1  Mc N N 13.04  ac    1  6.7  60.5
10     10     1  C-H 2017  3  1   H N N 11.38  ac    1 10.7  82.0
11     11     1  C-H 2017  3  1   H N N 11.38  ac    1  4.4  27.0
12     12     1  C-H 2018  3  1   H N N 11.08  ac    1  5.8  49.0
13     13     1  C-H 2018  3  1   H N N 11.08  ac    1  4.3  64.2
14     14     1  C-H 2013  4  1 McH N N 15.09  ac    1 11.4  86.0
15     15     1  C-H 2013  4  1 McH N N 15.09  ac    1  7.6  87.5
16     16     1  C-H 2014  4  1 McH N N 14.17  ac    1  5.8  60.1
17     17     1  C-H 2014  4  1 McH N N 14.17  ac    1 11.5 100.5
18     18     1  C-H 2014  4  1 McH N N 14.17  ac    1  4.7  53.2
19     19     1  C-H 2019  5  1 MnH N N 11.72  ac    1  8.1  56.0
20     20     1  C-H 2019  5  1 MnH N N 11.72  ac    1  7.1  56.0
21     21     1  C-H 2019  5  1 MnH N N 11.72  ac    1  7.1  56.0
22     22     1  C-H 2020  5  1 MnH N N 14.71  ac    1  7.0  78.2
23     23     1  C-H 2020  5  1 MnH N N 14.71  ac    1  5.2  47.2
24     24     1  C-H 2020  5  1 MnH N N 14.71  ac    1  7.0  83.5
595     1     1  C-H 2002  1  1  Mn N N 14.55  ac    2  9.6  96.0
596     2     1  C-H 2002  1  1  Mn N N 14.55  ac    2  6.0  72.0
597     3     1  C-H 2003  1  1  Mn N N 13.34  ac    2  5.7  75.0
598     4     1  C-H 2003  1  1  Mn N N 13.34  ac    2  7.5 101.0
599     5     1  C-H 2003  1  1  Mn N N 13.34  ac    2  6.9  58.0
600     6     1  C-H 2008  2  1  Mc N N 11.63  ac    2  6.0  84.0
601     7     1  C-H 2008  2  1  Mc N N 11.63  ac    2  6.3  72.0
602     8     1  C-H 2011  2  1  Mc N N 13.04  ac    2  7.4 101.0
603     9     1  C-H 2011  2  1  Mc N N 13.04  ac    2  5.6  62.0
604    10     1  C-H 2017  3  1   H N N 11.38  ac    2 10.7 110.0
605    11     1  C-H 2017  3  1   H N N 11.38  ac    2  4.7  60.0
606    12     1  C-H 2018  3  1   H N N 11.08  ac    2  6.4  48.0
607    13     1  C-H 2018  3  1   H N N 11.08  ac    2  5.6  70.0
608    14     1  C-H 2013  4  1 McH N N 15.09  ac    2 11.0 116.0
609    15     1  C-H 2013  4  1 McH N N 15.09  ac    2  7.5 104.0
610    16     1  C-H 2014  4  1 McH N N 14.17  ac    2  6.5  61.0
611    17     1  C-H 2014  4  1 McH N N 14.17  ac    2 10.9 110.0
612    18     1  C-H 2014  4  1 McH N N 14.17  ac    2  5.9  50.0
613    19     1  C-H 2019  5  1 MnH N N 11.72  ac    2  8.1  76.0
614    20     1  C-H 2019  5  1 MnH N N 11.72  ac    2  7.1  82.0
615    21     1  C-H 2019  5  1 MnH N N 11.72  ac    2  7.1  82.0
616    22     1  C-H 2020  5  1 MnH N N 14.71  ac    2  7.6  98.0
617    23     1  C-H 2020  5  1 MnH N N 14.71  ac    2  6.1  70.0
618    24     1  C-H 2020  5  1 MnH N N 14.71  ac    2  8.4  95.0
1189    1     1  C-H 2002  1  1  Mn N N 14.55  ac    3 13.0 109.0
1190    2     1  C-H 2002  1  1  Mn N N 14.55  ac    3  9.8  77.0
1191    3     1  C-H 2003  1  1  Mn N N 13.34  ac    3  8.0  80.0
1192    4     1  C-H 2003  1  1  Mn N N 13.34  ac    3 13.0 113.0
1193    5     1  C-H 2003  1  1  Mn N N 13.34  ac    3   NA    NA
1194    6     1  C-H 2008  2  1  Mc N N 11.63  ac    3  7.7  89.0
1195    7     1  C-H 2008  2  1  Mc N N 11.63  ac    3  9.5  84.0
1196    8     1  C-H 2011  2  1  Mc N N 13.04  ac    3  6.2 122.0
1197    9     1  C-H 2011  2  1  Mc N N 13.04  ac    3   NA    NA
1198   10     1  C-H 2017  3  1   H N N 11.38  ac    3 11.5 104.0
1199   11     1  C-H 2017  3  1   H N N 11.38  ac    3  6.1  62.0
1200   12     1  C-H 2018  3  1   H N N 11.08  ac    3   NA    NA
1201   13     1  C-H 2018  3  1   H N N 11.08  ac    3   NA    NA
1202   14     1  C-H 2013  4  1 McH N N 15.09  ac    3 15.4 100.0
1203   15     1  C-H 2013  4  1 McH N N 15.09  ac    3  4.8 113.0
1204   16     1  C-H 2014  4  1 McH N N 14.17  ac    3   NA    NA
1205   17     1  C-H 2014  4  1 McH N N 14.17  ac    3   NA    NA
1206   18     1  C-H 2014  4  1 McH N N 14.17  ac    3   NA    NA
1207   19     1  C-H 2019  5  1 MnH N N 11.72  ac    3 12.4  92.0
1208   20     1  C-H 2019  5  1 MnH N N 11.72  ac    3  9.6  88.0
1209   21     1  C-H 2019  5  1 MnH N N 11.72  ac    3  9.6  88.0
1210   22     1  C-H 2020  5  1 MnH N N 14.71  ac    3 11.0  94.0
1211   23     1  C-H 2020  5  1 MnH N N 14.71  ac    3  9.0  75.0
1212   24     1  C-H 2020  5  1 MnH N N 14.71  ac    3 10.5 100.0
1783    1     1  C-H 2002  1  1  Mn N N 14.55  ac    4 13.5 102.0
1784    2     1  C-H 2002  1  1  Mn N N 14.55  ac    4   NA  76.0
1785    3     1  C-H 2003  1  1  Mn N N 13.34  ac    4 11.0  79.0
1786    4     1  C-H 2003  1  1  Mn N N 13.34  ac    4 11.8 115.0
1787    5     1  C-H 2003  1  1  Mn N N 13.34  ac    4   NA    NA
1788    6     1  C-H 2008  2  1  Mc N N 11.63  ac    4   NA  84.0
1789    7     1  C-H 2008  2  1  Mc N N 11.63  ac    4 10.5  84.0
1790    8     1  C-H 2011  2  1  Mc N N 13.04  ac    4 10.4 125.0
1791    9     1  C-H 2011  2  1  Mc N N 13.04  ac    4   NA    NA
1792   10     1  C-H 2017  3  1   H N N 11.38  ac    4 10.2 108.0
1793   11     1  C-H 2017  3  1   H N N 11.38  ac    4  7.2  66.0
1794   12     1  C-H 2018  3  1   H N N 11.08  ac    4   NA    NA
1795   13     1  C-H 2018  3  1   H N N 11.08  ac    4   NA    NA
1796   14     1  C-H 2013  4  1 McH N N 15.09  ac    4 18.5 121.0
1797   15     1  C-H 2013  4  1 McH N N 15.09  ac    4 15.0 106.0
1798   16     1  C-H 2014  4  1 McH N N 14.17  ac    4   NA    NA
1799   17     1  C-H 2014  4  1 McH N N 14.17  ac    4   NA    NA
1800   18     1  C-H 2014  4  1 McH N N 14.17  ac    4   NA    NA
1801   19     1  C-H 2019  5  1 MnH N N 11.72  ac    4 11.4 114.0
1802   20     1  C-H 2019  5  1 MnH N N 11.72  ac    4 10.6  83.0
1803   21     1  C-H 2019  5  1 MnH N N 11.72  ac    4 10.6  83.0
1804   22     1  C-H 2020  5  1 MnH N N 14.71  ac    4  8.2  94.0
1805   23     1  C-H 2020  5  1 MnH N N 14.71  ac    4  9.1  30.0
1806   24     1  C-H 2020  5  1 MnH N N 14.71  ac    4 11.0 111.0
2377    1     1  C-H 2002  1  1  Mn N N 14.55  ac    5 14.2 110.0
2378    2     1  C-H 2002  1  1  Mn N N 14.55  ac    5 10.7  92.0
2379    3     1  C-H 2003  1  1  Mn N N 13.34  ac    5 10.1  91.0
2380    4     1  C-H 2003  1  1  Mn N N 13.34  ac    5 12.3 128.0
2381    5     1  C-H 2003  1  1  Mn N N 13.34  ac    5   NA    NA
2382    6     1  C-H 2008  2  1  Mc N N 11.63  ac    5  8.5  86.0
2383    7     1  C-H 2008  2  1  Mc N N 11.63  ac    5  9.6  89.0
2384    8     1  C-H 2011  2  1  Mc N N 13.04  ac    5 11.3 130.0
2385    9     1  C-H 2011  2  1  Mc N N 13.04  ac    5   NA    NA
2386   10     1  C-H 2017  3  1   H N N 11.38  ac    5 11.2 110.0
2387   11     1  C-H 2017  3  1   H N N 11.38  ac    5  8.5  83.0
2388   12     1  C-H 2018  3  1   H N N 11.08  ac    5   NA    NA
2389   13     1  C-H 2018  3  1   H N N 11.08  ac    5   NA    NA
2390   14     1  C-H 2013  4  1 McH N N 15.09  ac    5 21.1 156.0
2391   15     1  C-H 2013  4  1 McH N N 15.09  ac    5 17.5 132.0
2392   16     1  C-H 2014  4  1 McH N N 14.17  ac    5   NA    NA
2393   17     1  C-H 2014  4  1 McH N N 14.17  ac    5   NA    NA
2394   18     1  C-H 2014  4  1 McH N N 14.17  ac    5   NA    NA
2395   19     1  C-H 2019  5  1 MnH N N 11.72  ac    5 15.1 132.0
2396   20     1  C-H 2019  5  1 MnH N N 11.72  ac    5  9.0 105.0
2397   21     1  C-H 2019  5  1 MnH N N 11.72  ac    5  9.9  90.0
2398   22     1  C-H 2020  5  1 MnH N N 14.71  ac    5 13.0 122.0
2399   23     1  C-H 2020  5  1 MnH N N 14.71  ac    5 12.3  91.0
2400   24     1  C-H 2020  5  1 MnH N N 14.71  ac    5 14.5 145.0

	[[alternative HTML version deleted]]

