Quantcast

wireframe and par(mfrow)

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

wireframe and par(mfrow)

Simone Gabbriellini-3
Hello List,

I have some plots with the wireframe() function, and I'd like to
display them in a single jpeg file. I know that par(mfrow=c(x,y)) will
divide my display window in x rows and y columns, and although this
works with plot(), it looks like it's not working with wireframe.
here's my code:

library(lattice)
library(Cairo)
CairoJPEG("wiley-rank.jpeg", width=960, height=480, quality=100, dpi=600)
par(mfrow=c(2,4))
for(i in c(6,8,10,12,14,16,18,20)){
        title<-paste(i,"-rank.txt",sep="")
        rank<-as.matrix(read.table(title, header=TRUE), nrow=5,ncol=4,byrow=FALSE)
        colnames(rank)<-c(.25,0.50,0.75,1.00)
        wireframe(rank, scales=list(arrows=FALSE), drape=TRUE, colorkey=TRUE,
xlab="η", ylab="π",zlab="corr", screen = list(z = 45, x = -70),
zlim=c(0,1), main="Rank")
}
dev.off()

any help more than welcome...

best regards,
Simone

--
Dr. Simone Gabbriellini

DigitalBrains srl
Amministratore

mobile: +39 3403975626
mail: [hidden email]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: wireframe and par(mfrow)

David Winsemius

On May 7, 2012, at 7:15 AM, Simone Gabbriellini wrote:

> Hello List,
>
> I have some plots with the wireframe() function, and I'd like to
> display them in a single jpeg file. I know that par(mfrow=c(x,y)) will
> divide my display window in x rows and y columns, and although this
> works with plot(), it looks like it's not working with wireframe.

Nor should you expect it to work. 'wireframe' is a lattice function.  
You should be looking at 'grid.layout' in grid and 'grid.arrange' in  
gridExtra.

Please read ?lattice which will explain the major differences between  
base and lattice graphics. Also locate the FAQ item regarding why  
lattice graphs do not appear (as they would not with that code.)

--
David.

> here's my code:
>
> library(lattice)
> library(Cairo)
> CairoJPEG("wiley-rank.jpeg", width=960, height=480, quality=100,  
> dpi=600)
> par(mfrow=c(2,4))
> for(i in c(6,8,10,12,14,16,18,20)){
> title<-paste(i,"-rank.txt",sep="")
> rank<-as.matrix(read.table(title, header=TRUE),  
> nrow=5,ncol=4,byrow=FALSE)
> colnames(rank)<-c(.25,0.50,0.75,1.00)
> wireframe(rank, scales=list(arrows=FALSE), drape=TRUE, colorkey=TRUE,
> xlab="η", ylab="π",zlab="corr", screen = list(z = 45, x = -70),
> zlim=c(0,1), main="Rank")
> }
> dev.off()
>
> any help more than welcome...
>
> best regards,
> Simone
>
> --
> Dr. Simone Gabbriellini
>
> DigitalBrains srl
> Amministratore
>
> mobile: +39 3403975626
> mail: [hidden email]
>
> ______________________________________________
> [hidden email] 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.

David Winsemius, MD
West Hartford, CT

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: wireframe and par(mfrow)

Simone Gabbriellini-3
Thanks a lot for pointing me to that!

Best,
Simone

2012/5/7 David Winsemius <[hidden email]>:

>
> On May 7, 2012, at 7:15 AM, Simone Gabbriellini wrote:
>
>> Hello List,
>>
>> I have some plots with the wireframe() function, and I'd like to
>> display them in a single jpeg file. I know that par(mfrow=c(x,y)) will
>> divide my display window in x rows and y columns, and although this
>> works with plot(), it looks like it's not working with wireframe.
>
>
> Nor should you expect it to work. 'wireframe' is a lattice function. You
> should be looking at 'grid.layout' in grid and 'grid.arrange' in gridExtra.
>
> Please read ?lattice which will explain the major differences between base
> and lattice graphics. Also locate the FAQ item regarding why lattice graphs
> do not appear (as they would not with that code.)
>
> --
> David.
>
>> here's my code:
>>
>> library(lattice)
>> library(Cairo)
>> CairoJPEG("wiley-rank.jpeg", width=960, height=480, quality=100, dpi=600)
>> par(mfrow=c(2,4))
>> for(i in c(6,8,10,12,14,16,18,20)){
>>        title<-paste(i,"-rank.txt",sep="")
>>        rank<-as.matrix(read.table(title, header=TRUE),
>> nrow=5,ncol=4,byrow=FALSE)
>>        colnames(rank)<-c(.25,0.50,0.75,1.00)
>>        wireframe(rank, scales=list(arrows=FALSE), drape=TRUE,
>> colorkey=TRUE,
>> xlab="η", ylab="π",zlab="corr", screen = list(z = 45, x = -70),
>> zlim=c(0,1), main="Rank")
>> }
>> dev.off()
>>
>> any help more than welcome...
>>
>> best regards,
>> Simone
>>
>> --
>> Dr. Simone Gabbriellini
>>
>> DigitalBrains srl
>> Amministratore
>>
>> mobile: +39 3403975626
>> mail: [hidden email]
>>
>> ______________________________________________
>> [hidden email] 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.
>
>
> David Winsemius, MD
> West Hartford, CT
>



--
Dr. Simone Gabbriellini

DigitalBrains srl
Amministratore
Head R&D

mobile: +39 3403975626
mail: [hidden email]

______________________________________________
[hidden email] 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.
Loading...