Hi
Andrewjohnclose wrote:> Hi,
>
> I am having trouble plotting a series of dendrograms using lattice and
grid
> code as found in Paul Murrells book R Graphics.
>
> This is the error message I recieve:
>
> Error in downViewport.vpPath(vpPathDirect(name), strict, recording >
recording) :
> Viewport 'plot1.panel.1.1.off.vp' was not found
>
> I have attached the code and also my data file. Should anyone have any
> suggestions then your help would be gratefully appreciated.
Your 'height' factor has values 1, 2, 2, 3 so when the second panel is
drawn (for 'height == 2'), there are two dendrograms to draw in the
panel. Specifically, 'dend4b$lower[[subscripts]]' fails because
'subscripts' is c(2, 3). You can see this with some crude debugging as
in ...
dendpanel <- function(x, y, subscripts, ...) {
pushViewport(viewport(y = space,
width = 0.90,
height = unit(0.90, "npc") - space,
just = "bottom"))
par(plt = gridPLT(), new = TRUE, ps = 10)
cat(subscripts, "\n")
plot(dend4b$lower[[subscripts]], axes = FALSE)
popViewport()
}
... and you can get something to work if you adjust the code like this ...
dendpanel <- function(x, y, subscripts, ...) {
pushViewport(viewport(y = space,
width = 0.90,
height = unit(0.90, "npc") - space,
just = "bottom"))
par(plt = gridPLT(), new = TRUE, ps = 10)
plot(dend4b$lower[subscripts][[1]], axes = FALSE)
popViewport()
}
... but that drops one of the dendrograms. You need to set up x, y, and
height differently so that they correspond better to the dendrogram
structure that you have in 'dend4b'.
Hope you can take it from there ...
Paul
> Thank you
>
> Andrew
> http://www.nabble.com/file/p17017801/dend4c.txt dend4c.txt
> http://www.nabble.com/file/p17017801/gL2.csv gL2.csv
--
Dr Paul Murrell
Department of Statistics
The University of Auckland
Private Bag 92019
Auckland
New Zealand
64 9 3737599 x85392
paul at stat.auckland.ac.nz
http://www.stat.auckland.ac.nz/~paul/