Hello,
I have encountered some unexpected behaviour with levelplot that may
simply be a misunderstanding on my part.
If I create a levelplot from a matrix with named columns, some
"padding" space appears at the top and bottom of the heatmap. Here is
an example, and I've used panel.fill to make the space I'm speaking of
evident (in green).
######################################################
library(lattice);
library(latticeExtra);
data <- matrix(
nrow = 5,
ncol = 2,
data = rnorm(10)
);
colnames(data) <- c("Col1", "Col2");
levelplot(
data,
panel = function(...) {
panel.fill(col = "green")
panel.levelplot(...);
},
aspect = "fill",
scales = list(
x = list(
labels = NULL,
tck = c(0,0)
),
y = list(
cex = 3
)
),
xlab = '',
ylab = ''
);
######################################################
If I now remove the column names and run the same code, this "padding"
space disappears.
######################################################
colnames(data) <- NULL;
levelplot(
data,
panel = function(...) {
panel.fill(col = "green")
panel.levelplot(...);
},
aspect = "fill",
scales = list(
x = list(
labels = NULL,
tck = c(0,0)
),
y = list(
cex = 3
)
),
xlab = '',
ylab = ''
);
######################################################
I am looking to create a levelplot that uses the entire area (like the
second example) but that has labeled rows (like the first). I'm very
confused about what's causing this padding, or where to look to remove
it. I attempted:
scale = list(x = list(axs = "r"), y = list(axs = "r"))
and that did not alter things.
Here is my system information:
> sessionInfo();
R version 2.7.2 (2008-08-25)
i386-pc-mingw32
locale:
LC_COLLATE=English_United States.1252;LC_CTYPE=English_United
States.1252;LC_MONETARY=English_United
States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] latticeExtra_0.5-2 RColorBrewer_1.0-2 lattice_0.17-15
loaded via a namespace (and not attached):
[1] grid_2.7.2
Any help/suggestions are very much appreciated,
Paul