[R] Is possible a mini-plot into a big plot with Lattice?

Paul Murrell p.murrell at auckland.ac.nz
Thu May 27 00:27:02 CEST 2010


Hi

On 27/05/2010 8:09 a.m., Walmes Marques Zeviani wrote:
>
> Hello,
>
> I want to do with Lattice functions (qqmath, histogram) a figure like this below.
> n<- 1000
> x<- rnorm(n)
> qqnorm(x); qqline(x)
> op<- par(fig=c(.02,.5,.5,.98), new=TRUE)
> hist(x, xlab="", ylab="", main="", axes=FALSE)
> box()
> par(op)
>
> Is possible?

Something like ... ?

library(lattice)
library(grid)
qqmath(x,
        panel=function(...) {
            panel.qqmath(...)
            panel.abline(a=0, b=1)
            pushViewport(viewport(.02, .5, .48, .48,
                                  just=c("left", "bottom")))
            print(histogram(x, xlab=NULL, ylab=NULL,
                            scales=list(draw=FALSE)),
                  newpage=FALSE)
            popViewport()
        })

Paul

> Thanks.
> Walmes Zeviani.
>
>   		 	   		
> _________________________________________________________________
> CANSADO DE ENTRAR EM TODAS AS SUAS DIFERENTES CONTAS DE EMAIL? JUNTE TODAS AGORA.
>
> [[elided Hotmail spam]]
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> 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.

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



More information about the R-help mailing list