[R] xyplot questions - axis and plotting two things in same panel
karin.lagesen at studmed.uio.no
Wed Jun 25 12:13:02 CEST 2008
I am trying to use xyplot to plot some graphs.
The data I have looks like this:
breaks numbers moltype type
1 0.0000000 6598 5S Between species
2 0.4066667 0 5S Between species
3 0.8133333 5228 5S Between species
4 1.2200000 0 5S Between species
5 1.6266667 9702 5S Between species
6 2.0333333 0 5S Between species
7 2.4400000 7834 5S Between species
8 2.8466667 0 5S Between species
9 3.2533333 12084 5S Between species
10 3.6600000 24 5S Between species
where moltype and type are factors, moltype having three different
levels, and type having two.
I am now plotting things like this:
xyplot(numbers~breaks|moltype+type, data = alldata, type = "l")
which gives me six panels showing just what I want.
Now, my first problem is how to plot two graphs in the same panel. I
would like one panel per moltype, but I want the type factor to result
in two graphs plotted in the same panel. How do I specify this?
I am also wondering about whether it is possible to change the x axis
scale here. I have data going from 0 to 35, but most of the
interesting stuff is between 0 and 5. Thus I am wondering if there is
any way of specifying that the 0 to 5 range should take up 30 % of the
x axis (or something like that) and gradually shrink the axis after
that. I have tried doing log on the x axis, but I have a lot of zeros
in my data set that really breaks everything.
Thanks for your help!
Karin Lagesen, PhD student
karin.lagesen at medisin.uio.no
More information about the R-help