Wolfgang Huber
2008-Feb-13 16:17 UTC
[Rd] Surprising behaviour of levelplot in lattice package
Hi Deepayan,
levelplot from the lattice package produces a peculiar output when
called on a matrix whose column or row names contained duplicated
elements. In particular, the plot contains white stripes, and the
arrangement of data regions and axes labels seems messed up. I did not
see this documented (my apologies if this is an oversight) and guess
that it is unintended:
library("lattice")
m = matrix(runif(12L), ncol=3L)
colnames(m) = c("A", "A", "B")
rownames(m) = c("x", "y", "y", "z")
print(levelplot(m))
Best wishes
Wolfgang
------------------------------------------------------------------
Wolfgang Huber EBI/EMBL Cambridge UK http://www.ebi.ac.uk/huber
> sessionInfo()
R version 2.7.0 Under development (unstable) (2008-02-13 r44450)
x86_64-unknown-linux-gnu
locale:
LC_CTYPE=it_IT.UTF-8;LC_NUMERIC=C;LC_TIME=it_IT.UTF-8;LC_COLLATE=it_IT.UTF-8;LC_MONETARY=it_IT.UTF-8;LC_MESSAGES=it_IT.UTF-8;LC_PAPER=it_IT.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=it_IT.UTF-8;LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] lattice_0.17-4 fortunes_1.3-4
loaded via a namespace (and not attached):
[1] grid_2.7.0>
Deepayan Sarkar
2008-Feb-13 19:44 UTC
[Rd] Surprising behaviour of levelplot in lattice package
On 2/13/08, Wolfgang Huber <huber at ebi.ac.uk> wrote:> Hi Deepayan, > > levelplot from the lattice package produces a peculiar output when > called on a matrix whose column or row names contained duplicated > elements. In particular, the plot contains white stripes, and the > arrangement of data regions and axes labels seems messed up. I did not > see this documented (my apologies if this is an oversight) and guess > that it is unintended:Yes, the current design does not anticipate the possibility of duplicated row and column names. A fix may or may not be simple; I will look into it. -Deepayan> > > library("lattice") > m = matrix(runif(12L), ncol=3L) > colnames(m) = c("A", "A", "B") > rownames(m) = c("x", "y", "y", "z") > print(levelplot(m)) > > > > Best wishes > Wolfgang > > ------------------------------------------------------------------ > Wolfgang Huber EBI/EMBL Cambridge UK http://www.ebi.ac.uk/huber > > > > > sessionInfo() > R version 2.7.0 Under development (unstable) (2008-02-13 r44450) > x86_64-unknown-linux-gnu > > locale: > LC_CTYPE=it_IT.UTF-8;LC_NUMERIC=C;LC_TIME=it_IT.UTF-8;LC_COLLATE=it_IT.UTF-8;LC_MONETARY=it_IT.UTF-8;LC_MESSAGES=it_IT.UTF-8;LC_PAPER=it_IT.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=it_IT.UTF-8;LC_IDENTIFICATION=C > > attached base packages: > [1] stats graphics grDevices utils datasets methods base > > other attached packages: > [1] lattice_0.17-4 fortunes_1.3-4 > > loaded via a namespace (and not attached): > [1] grid_2.7.0 > > > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel >
Deepayan Sarkar
2008-Feb-13 19:47 UTC
[Rd] Surprising behaviour of levelplot in lattice package
On 2/13/08, Deepayan Sarkar <deepayan.sarkar at gmail.com> wrote:> On 2/13/08, Wolfgang Huber <huber at ebi.ac.uk> wrote: > > Hi Deepayan, > > > > levelplot from the lattice package produces a peculiar output when > > called on a matrix whose column or row names contained duplicated > > elements. In particular, the plot contains white stripes, and the > > arrangement of data regions and axes labels seems messed up. I did not > > see this documented (my apologies if this is an oversight) and guess > > that it is unintended: > > Yes, the current design does not anticipate the possibility of > duplicated row and column names. A fix may or may not be simple; I > will look into it.Actually, the fix should be easy. A workaround is levelplot(m, ylim = colnames(m), xlim = rownames(m)) -Deepayan