Skip to content
Prev 71785 / 398498 Next

Plotting rows (or columns) from a matrix in different graphs, not using "par"

On Tue, 2005-06-14 at 20:00 +0200, Camarda, Carlo Giovanni wrote:
If I am understanding what you are trying to do, then using xyplot()
from the lattice package (part of the standard R installation) may be
best:

Modify 'mat' so that all data is in 'df':
"Years" = rep(1950:1953, 4),
                   "Group" = rep(LETTERS[1:4], each = 4))
Simul Years Group
1   88.67956  1950     A
2  364.73579  1951     A
3  546.63525  1952     A
4  774.05869  1953     A
5  138.09586  1950     B
6  382.20986  1951     B
7  592.85512  1952     B
8  810.45569  1953     B
9  232.43912  1950     C
10 524.91085  1951     C
11 598.49688  1952     C
12 963.97328  1953     C
13 261.80598  1950     D
14 533.91143  1951     D
15 765.72522  1952     D
16 996.72192  1953     D


# Load the lattice package
# Draw the plot, note the use of standard R formulae in the syntax
# with the addition of the grouping vector after the '|'
See:

library(lattice)
?xyplot

for more information.

HTH,

Marc Schwartz