see below

George Kalema wrote:
Dear R users,
I am trying to have an xyplot of a data set which has the following
variables:
case (n=10,20,30)
parameter (parm=a,b)
group (grp=g1,g2)
y (y values)
x (x=2,4,8)

My plot should be parameter by case such that I have 2 rows (each row= each
parameter) and 3 columns (each column=each case). My R-code is as follows
but I am not able to get what I want to:

tp1.sim <- xyplot(y~ x | case + parm , group=group, data = data, lty = 1:4 ,
pch = 1:4)
print(tp1.sim)

How can I have two lines (for g1 and g2) in each plot (each box)?
include the type="b" argument

How do I label the x-axis with only values 2, 4, 8?
include the scales= argument or make x a factor

How do I label each column with the corresponding case number?
make 'case' a factor

The following should do what you want:

xyplot(y ~ x | factor(case) + parm, group=group, data=data,
    type='b', lty=1:2, pch=1:2,
    scales=list(x=list(at=c(2,4,8)))
)

I don't understand why you want 4 line types/point chars.

 -Peter Ehlers


My hypothetical data set is as follows:

parm x case y group
a 2 10 0.03 g1
b 2 10 0.02 g1
a 4 10 0.03 g1
b 4 10 0.02 g1
a 8 10 0.03 g1
b 8 10 0.02 g1
a 2 20 0.03 g1
b 2 20 0.02 g1
a 4 20 0.03 g1
b 4 20 0.02 g1
a 8 20 0.03 g1
b 8 20 0.02 g1
a 2 30 0.03 g1
b 2 30 0.02 g1
a 4 30 0.03 g1
b 4 30 0.02 g1
a 8 30 0.03 g1
b 8 30 0.02 g1
a 2 10 0.13 g2
b 2 10 0.12 g2
a 4 10 0.13 g2
b 4 10 0.12 g2
a 8 10 0.13 g2
b 8 10 0.12 g2
a 2 20 0.13 g2
b 2 20 0.12 g2
a 4 20 0.13 g2
b 4 20 0.12 g2
a 8 20 0.13 g2
b 8 20 0.12 g2
a 2 30 0.13 g2
b 2 30 0.12 g2
a 4 30 0.13 g2
b 4 30 0.12 g2
a 8 30 0.13 g2
b 8 30 0.12 g2

Many thanks in advance for your response.

George

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to