Re: [R] Error in downViewport.vpPath(vpPathDirect(name)

From: Paul Murrell <p.murrell_at_auckland.ac.nz>
Date: Mon, 05 May 2008 14:07:45 +1200

Hi

Paul Murrell wrote:
> 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


BTW, you are getting this error because the panel function is failing (so the popViewport() never happens and lattice gets left inside the grid viewport that you pushed and so lattice cannot find the viewports that it is expecting to be able to see).

Paul

>> 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/

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Mon 05 May 2008 - 02:40:35 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 05 May 2008 - 03:30:36 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive