[R] bizarre axes with xyplot, problem in data?

Steven McKinney smckinney at bccrc.ca
Thu Oct 30 21:47:50 CET 2008

> If anyone is bored I am still interested in why R
> orders lattice plots from bottom to top.

The idea was that, just as small values of
x are typically found to the left end of the X axis
and small values of y are typically found at the
bottom end of the Y axis; a trellis plot corresponding
to a small value of the conditioning variable should 
appear to the lower left of the trellis plot set,
and a trellis plot corresponding to a large value of 
the conditioning variable should be found to the upper 
right of the trellis plot set.  

Sounds like wise graphical layout policy, but is 
surprisingly confusing in many cases.  Thankfully
Deepayan Sarkar has included options to allow
alternate layouts.

Becker, Cleveland, Shyu, Kaluzny
Section 2.6 Layout
"Remember that trellis displays are filled as graphs,
from the origin in the lower left, not top-down as in
a table." )

Steven McKinney

Molecular Oncology and Breast Cancer Program
British Columbia Cancer Research Centre

email: smckinney +at+ bccrc +dot+ ca

tel: 604-675-8000 x7561

Molecular Oncology
675 West 10th Ave, Floor 4
Vancouver B.C. 
V5Z 1L3

-----Original Message-----
From: r-help-bounces at r-project.org on behalf of Phillip Porter
Sent: Thu 10/30/2008 11:43 AM
To: r-help at r-project.org
Subject: Re: [R] bizarre axes with xyplot, problem in data?
My SAS brain was still plugged in.  I had a missing data point entered as a
"."  I didn't think anything of it since SAS treats that as missing data.
Apparently it confuses R.  I deleted the "." re-imported the data and
everything was beautiful.  If anyone is bored I am still interested in why R
orders lattice plots from bottom to top.


On Thu, Oct 30, 2008 at 1:25 PM, Phillip Porter <philnotfil at gmail.com>wrote:

> Good Morning,
> I am using xyplot to show two variables for each of several subjects as
> follows:
> xyplot(y~x|as.factor(ID), type="b", layout=c(7,9),
> scales=list(x=list(tick.number=3), y=list(tick.number=5)))
> This is almost exactly the code I used for an earlier project, the only
> change is the number of ticks, but I'm getting all kinds of craziness on my
> Y axis.  I played around with everything, and by only using the first 100 or
> so subjects I can get everything to work out right, but when I run the whole
> dataset my Y axis goes crazy.  When I do 1,1 in layout and stretch the
> window the full height of my screen it looks like it is starting at 100 and
> going up to the top value of my Y data, and then continuing on the Y values
> lower than 100, but everything is overlapped so I'm not quite sure.
> Is the problem in my data? (read.csv from an excel file) Is it in the range
> of my data?  Is it some little detail I'm leaving out of my code?
> Thanks,
> Phillip
> P.S.  This isn't very important, but I am curious and maybe one of you
> knows, why does R start from the bottom and go up when doing the lattice
> plots?  My first subjects are at the bottom of the page, and move higher as
> you move up the page.

	[[alternative HTML version deleted]]

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.

More information about the R-help mailing list