[R] xyplot questions - axis and plotting two things in same panel

From: Karin Lagesen <karin.lagesen_at_studmed.uio.no>
Date: Wed, 25 Jun 2008 12:13:02 +0200

Hi list!

I am trying to use xyplot to plot some graphs.

The data I have looks like this:

> alldata[1:10,]

      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

R-help_at_r-project.org mailing list
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Wed 25 Jun 2008 - 14:18:15 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 25 Jun 2008 - 21:31:24 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive