[R] levelplot border and dendrogram width
Paul Boutros
paul.boutros at utoronto.ca
Sun Dec 16 23:13:36 CET 2007
Hello,
I'm trying to learn how to use lattice and levelplot in particular.
There are three elements of customizing the plots I'm stuck with:
a) Is there a way to put borders around each "cell" within a
level-plot. I'm trying to do something like the
colsep/rowsep/sepcolor/sepwidth parameters of heatmap.2 in gplots
b) Can I alter the line-width of dendrogram added to the levelplot
using latticeExtra?
c) Can I alter the spacing between the dendrogram and a row of
coloured rectanges added to a dendrogram using the add option?
The basic code-example that I've been trying to tweak is below, any
suggestions and hints are very much welcome!! In particular, I'm not
sure where to find documentation on parameters for these, so hints on
where to look would be great!
Paul
library(lattice);
library(latticeExtra);
tmp <- rnorm(100);
tmp <- matrix(data = tmp, nrow = 10, ncol = 10);
dd.row <- as.dendrogram( hclust( dist( tmp ) ) );
levelplot(
tmp[order.dendrogram(dd.row), ],
aspect = "fill",
scales = list(
x = list(rot = 90)
),
colorkey = list(
space = "left"
),
legend = list(
top = list(
fun = dendrogramGrob,
args = list(
x = dd.row,
ord = order.dendrogram(dd.row),
side = "top",
add = list(
rect = list(
col = "black",
fill = c(
rep("blue", 5),
rep("green",5)
),
lwd = 3
),
type = "rectangle"
),
size.add = 1,
size = 10,
type = "rectangle"
)
)
)
);
More information about the R-help
mailing list