From bill at insightful.com  Wed Mar  7 21:31:36 2007
From: bill at insightful.com (bill at insightful.com)
Date: Wed,  7 Mar 2007 21:31:36 +0100 (CET)
Subject: [Rd] missing axes in irregular lattice plots (PR#9556)
Message-ID: <20070307203136.A2B7A5AC23@slim.kubism.ku.dk>

In the lattice functions, if the first or last
panel in a row or column is not at the edge of the array
of panels there will be no axis drawn for that row or column,
except that when the said panel is the last in the array
its right y axis will be drawn.  For example,
 > d<-data.frame(x=1:20, y=1:20, g=rep(LETTERS[1:4],len=20))
 > library(lattice)
 > bwplot(floor(x/8)~y|g, layout=c(1,3), as.table=T, data=d)
That bwplot() call should make 2 pages of panels with 3 panels
on page 1 and 1 panel on page 2.  The single panel on the second
page has x tick marks at its top edge, but no tick marks or
labels below it.  Thus you have to look at the first page of
panel to determine the x scale.

In the second example (using the same data.frame) there
are no x or y tick labels for any panel.
 > xyplot(y~x|g, layout=c(3,3), skip=c(T,T,F, F,F,T, T,F,T), as.table=T, data=d)
This example is rather contrived, but might arise when one
wants to omit panels with no data in them but to leave a
hole in the array for unused factor levels in the given
vector.

Exactly the same problem happens in S-Plus.  I patched it to
put an axis on the first and last panels in each row and
column, instead of only on the plots in position 1 and nrow
(or ncol) of each row and column.

One might also fix it by putting axes all around the array of
plots, at the edge of the array.  Perhaps you only want axes
on rows and columns that have at least one plot in them.

One might prefer to only attack the layout(1,n),as.table=T
problem by making sure the last plot has x axis tick labels
associated with it, just as the last plot always gets y
axis tick labels associated with it.

----------------------------------------------------------------------------
Bill Dunlap
Insightful Corporation
bill at insightful dot com
360-428-8146

 "All statements in this message represent the opinions of the author and do
 not necessarily reflect Insightful Corporation policy or position."

--please do not edit the information below--

Version:
 platform = i686-pc-linux-gnu
 arch = i686
 os = linux-gnu
 system = i686, linux-gnu
 status = Under development (unstable)
 major = 2
 minor = 5.0
 year = 2007
 month = 02
 day = 05
 svn rev = 40659
 language = R
 version.string = R version 2.5.0 Under development (unstable) (2007-02-05 r40659)

Locale:
LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US.UTF-8;LC_MONETARY=en_US.UTF-8;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en_US.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFICATION=C

Search Path:
 .GlobalEnv, package:lattice, package:stats, package:graphics, package:grDevices, package:utils, package:datasets, package:methods, Autoloads, package:base



[Rd] missing axes in irregular lattice plots (PR#9556)
bill at insightful.com