[R] grid.newpage()
Paulo Cardoso
pecardoso at netcabo.pt
Thu Sep 25 17:16:11 CEST 2008
Sorry but this is not printing both graphs in the same window and I can't
figure why.
grid.newpage()
par(cex.axis=0.85,cex.lab=0.80,mai=c(1.3,1,0.5,0),las=3)
pushViewport(viewport(layout=grid.layout(1,2)))
pushViewport(viewport(layout.pos.row=1,layout.pos.col=1))
print(
bplot<-barplot(bar.values,width=0.5,ylab="% Area held",names.arg=cf.names),
abline(h=0.3,lty=3,col="red"),
abline(h=0.1,lty=3,col="blue"),
points(bplot,target$target/xi[nrow(xi),],pch=20),
text(bplot,target$target/xi[nrow(xi),],paste(target$target,"ha"),adj=c(-0.3,
0.5),cex=0.70,srt=90)
)
popViewport()
#pushViewport(viewport(layout=grid.layout(1,2)))
pushViewport(viewport(layout.pos.row=1,layout.pos.col=2))
print(barplot(xi[c(floor(327/4),floor(327/2)),c(2,5,11)],
names.arg=c("Coral","Mangrove","Seagrass"),
las=3))
> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Paulo Cardoso
> Sent: quinta-feira, 25 de Setembro de 2008 15:50
> To: 'r'
> Subject: [R] grid.newpage()
>
> Hi,
>
> I'm trying to customize a window with 2 graphs.
>
> I'm able to do the first one with something like this general example
>
> par(mfrow=c(1,2),cex.axis=0.85,cex.lab=0.80,mai=c(1.3,1,0.5,0),las=3)
> bplot<-barplot(bar.values,names.arg=cf.names,width=0.5,ylab="% Area
> held")
> abline(h=0.3,lty=3,col="red")
> abline(h=0.1,lty=3,col="blue")
> points(bplot,target$target/xi[nrow(xi),],pch=20)
> text(bplot,target$target/xi[nrow(xi),],paste(target$target,"ha"),adj=c(
> -0.3,
> 0.5),cex=0.70,srt=90)
>
> But it fails when I try to put it into a grid with something like this:
>
> grid.newpage()
> par(cex.axis=0.85,cex.lab=0.80,mai=c(1.3,1,0.5,0),las=3)
> pushViewport(viewport(layout=grid.layout(1,2)))
> pushViewport(viewport(layout.pos.row=1,layout.pos.col=1))
> print(
> bplot<-barplot(bar.values,width=0.5,ylab="% Area
> held",,names.arg=cf.names)
> abline(h=0.3,lty=3,col="red"))
> abline(h=0.1,lty=3,col="blue")
> points(bplot,target$target/xi[nrow(xi),],pch=20) #!
> ,col=c(4,2,4,4,2,4,4,4,4,4,2,4)
> text(bplot,target$target/xi[nrow(xi),],paste(target$target,"ha"),adj=c(
> -0.3,
> 0.5),cex=0.70,srt=90)
> )
> popViewport(1)
>
> It fails to print ablines, points and text.
>
> Any idea?
>
>
> -----------------------------------------------------------------------
> -----
> -------------------------------------------------
> This electronic mail transmission including any attachment hereof,
> contains
> information that is private and confidential, and it is only for the
> use of
> the person and at the e-mail address above indicated. If you have
> received
> this electronic mail transmission in error, please destroy it and
> notify me
> immediately through e-mail address: pecardoso at netcabo.pt
>
> ______________________________________________
> 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.
> No virus found in this incoming message.
> Checked by AVG.
> Version: 8.0.100 / Virus Database: 270.7.1/1688 - Release Date: 24-09-
> 2008 6:29
More information about the R-help
mailing list