[R] plot method for rasters and layout

Olivier Eterradossi Olivier.Eterradossi at mines-ales.fr
Mon Mar 19 13:59:24 CET 2012


Mike,
It is with SDI in Windows.

Here is reproducible code (by the way, I just add the opening of any raster and plot it four times).

> library (raster)
>  b<- brick(system.file("external/rlogo.grd", package="raster"))
> layout.matrix<-matrix(c(1,2,3,4,5,5),2,3,byrow=TRUE)
> layout(mat=layout.matrix)
> layout.show(5)
> plot(b[[1]])
> plot(b[[1]])
> plot(b[[1]])
> plot(b[[1]])

Running this I get the four R logos in quadrants [,1:3] and [2,1], not in [1:2,1:2]

I've read the thread you suggest, I'm afraid I don't fully understand it.
Last tiume I updated R December 2011 from CRAN, so it seems that it is posterior to the fix.
 I'll update to 2.14 asap.

Thank you. Olivier

-----Message d'origine-----
De : Michael Sumner [mailto:mdsumner at gmail.com] 
Envoyé : lundi 19 mars 2012 13:23
À : Olivier Eterradossi
Cc : r-help at r-project.org
Objet : Re: [R] plot method for rasters and layout

Is this with SDI in Windows? I'd update to a recent version of R, and please provide reproducible code next time.

It could be the same as this issue, now long ago fixed:
https://stat.ethz.ch/pipermail/r-devel/2011-February/059906.html

Cheers, Mike.

On Mon, Mar 19, 2012 at 9:57 PM, Olivier Eterradossi <Olivier.Eterradossi at mines-ales.fr> wrote:
> Hi list,
>
> I thought I was used to layouts, but today I am facing a problem I 
> cannot overcome  :
>
>
>
> On my R installation (Windows 7 Pro, SP1, R version 2.13.0, daily 
> update of packages), I am not able to put raster plots in user defined layouts :
>
>
>
>> layout.matrix<-matrix(c(1,2,3,4,5,5),2,3)
>
>> layout(mat=layout.matrix)
>
>> layout.show(5)
>
>
>
> works fine, I get the correct frames in the correct place. But, using 
> 5 graphs (that all plot OK if plotted alone) :
>
>
>
>> plot(raster1)
>
>> plot(raster2)
>
>> plot(raster3)
>
>> plot(raster4)
>
>> plot(any.other.graph.meant.to.be.in.frame.5)
>
>
>
> Plots giving the same layout  as :
>
>
>
>> par(mfrow=c(2,3))
>
>> plot(raster1)
>
>> plot(raster2)
>
>> plot(raster3)
>
>> plot(raster4)
>
>> plot(any.other.graph.supposed.to.fall.in.frame.5)
>
>
>
> i.e. 3 rasterplots on the first row followed by the fourth raster and 
> the fifth graph, all of same size, the [2,3] frame being empty.
>
>
>
> I suppose this is due to a conflict between layout and the 
> bigplot/smallplot approach used by the imageplot() function, from 
> which the plot method for rasters is said to be inspired. But I am not sure and I cannot work it out.
>
>
>
> Do I miss something, and can anybody help ?
>
>
>
> All the best to all of you, thanks as always for all the work done here !
> Olivier
>
>
>
> --------------------------
>
> Olivier ETERRADOSSI
>
> Maître-Assistant, HDR
>
> Ecole des Mines d’Alès (CMGD, site de Pau)
>
> Pôle Matériaux Polymères Avancés (MPA)
>
> Hélioparc, 2 av. P. Angot, F-64053 PAU CEDEX 9
>
> Tel : 05 59 30 90 35 (direct) - 05 59 30  54 25 (std)
>
> Fax : 05 59 30 63 68
>
>
>
>
>        [[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.
>



--
Michael Sumner
Institute for Marine and Antarctic Studies, University of Tasmania Hobart, Australia
e-mail: mdsumner at gmail.com



More information about the R-help mailing list