We don't have your data, so we cannot reproduce what you are doing and the
plot was stripped off before we saw it (only certain types of attachments are
allowed, and some e-mail programs don't give the correct information about
attachments so even those types can be stripped if it is not clear what they
are).
Here are some possible hints that may help (if I have guessed correctly about
what you are trying to do).
Read the help page for par, looking at the information on margins and outer
margins, this can be used to give you more room for your titles (also the xpd
argument if you are placing things outside the plot area). Also look at the
various cex arguments for controlling sizes.
Try using mtext instead of text to manually add titles or other text in the
margins.
Sometimes using the outer margins works better than using the regular margins
(sometimes not).
The text function uses the user coordinates of the current plot, the functions
grconvertX and grconvertY can be used to convert between the different
coordinate systems.
Hope this helps,
--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
801.408.8111
> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of mauede at alice.it
> Sent: Wednesday, January 28, 2009 8:52 AM
> To: r-help at stat.math.ethz.ch
> Cc: gunter.berton at gene.com
> Subject: [R] help with plot layout
>
> It takes a lot of sweat to generate a composite plot with R ... sigh.
> I though I was almost done when I met the umpteenth hurdle. I cannot
> place a nice title on the 2nd plot (raw signal)
> on the layout. I do not have control on where either the "main"
option
> of "plot" function, or "title", place the text
> string which keeps dysplaying chopped from above. I also tried
"text",
> changing many times the string coordinates, but could not see any text
> anywhere on the canvas .
> By the way, since the layout breaks the canvas into 4 parts, are the
> text coordinates absolute (referred to the canvas) or
> relative (referred to the part) ?
> Please, find attached the generated drawing. The generating script is i
> the following.
> Thank you so much,
> Maura
>
> ##################################################################
> WavMaxNumCoef <- 30
> setwd("C:/Documents and
Settings/Monville/SpAn-Tests/16440-Raw-Dir")
>
> xx <- read.table("Interp-Amp-PhasePlus16440.txt",header=TRUE,
sep=" ")
> NumCycles <- max(xx[,"cycle"])
> TickPos <- vector(length=NumCycles)
> TickCoord <- vector(length=NumCycles)
> for(i in 1:NumCycles) {
> TickPos[i] <- xx[min(which(xx[,"cycle"] == i)),1]
> }
>
> aa <- read.table( "16440-Alpha.txt" )
> xaa <- seq(1:length(t(aa)))
>
> vv <- read.table("16440-Vanishing-Moments")
> vvLab <- seq(1,WavMaxNumCoef/2,1)
> vvCounts <- vector(length=WavMaxNumCoef/2)
> for(k in 1:(WavMaxNumCoef/2)) {
> vvCounts[k] <- length(which(vv[] == k))
> }
> yyLab <- seq(1,length(t(vv)),2)
>
> bb <- read.table("16440-Length")
> bbLab <- seq(min(bb),max(bb),1)
> bb <- sort(t(bb))
> bbCounts <- as.numeric(vector(length=(max(bb)-min(bb)+1)))
> for(k in 1:length(bbCounts)) {
> bbCounts[k] <- length(which(bb[] == (k +min(bb) -1)))
> }
> zzLab <- seq(1,max(bbCounts),1)
>
> # DEFINE LAYOUT
> x11(width=22,height=14)
> nf <- layout(matrix(c(1,3,2,4),2,2,byrow=TRUE), c(3,1), c(2,2),FALSE)
> layout.show(nf)
>
> # PLOT DONOHO ALPHA
> par(mar=c(10,4,2,5),xaxt="n",cex.axis=1,pty="m")
> plot(xaa,t(aa),type="h")
> par (xaxt="s",xaxp=c(0,95.964,24),xaxs="i")
>
>
axis(1,at=TickPos,labels=as.character(TickPos),col="red",col.axis="red"
> ,font.axis=1)
>
> # PLOT RAW SIGNAL
> par(mar=c(3,4,0,5),xaxt="n",cex.axis=1,pty="m")
> plot(xx[,1],xx[,2],pch=3,type="l",frame.plot=FALSE,xpd=TRUE)
> title("Raw Signal 16440",cex.main=1.0,font=2)
> par (xaxt="s",xaxp=c(0,95.964,24),xaxs="i")
>
>
axis(1,at=TickPos,labels=as.character(TickPos),col="red",col.axis="red"
> , font.axis=1)
>
> # PLOT VANISHING MOMENT DISTRIBUTION
>
par(mar=c(1,0,2,3),xaxt="n",yaxt="n",cex.axis=0.7,pty="m")
> barplot(vvCounts,width=1,space=0,horiz=TRUE,axes=FALSE)
>
par(xaxt="s",yaxt="s",crt=180,srt=270,adj=1,las=3,xpd=TRUE)
> text(x=25.5,y=15.3,pos=4,"Wavelet Vanishing Moments
> Distribution",cex=1.0,font=2)
> axis(2,at=vvLab-
>
1,labels=as.character(vvLab),col="red",col.axis="red",font.axis=1,xpd=T
> RUE,
> cex.lab=1)
> axis(3,at=yyLab-
>
1,labels=as.character(yyLab),col="red",col.axis="red",font.axis=1,xpd=T
> RUE,
> cex.lab=0.8,cex.axis=0.8)
>
> # PLOT CYCLES LENGTH
> par(mar=c(0,0,1,3),xaxt="n",yaxt="n",cex.axis=1)
> barplot(bbCounts,width=1,axes=FALSE,space=0,horiz=TRUE)
>
>
par(xaxt="s",yaxt="s",crt=180,srt=270,adj=1,las=3,cex.lab=0.1,xpd=TRUE)
> text(x=15.5,y=65.3,pos=4,"Cycles Length
Distribution",cex=1.0,font=2)
> axis(2,at=as.numeric(bbLab)-
> 41,labels=bbLab,col="red",col.axis="red",font.axis=1,
> lab=c(10,10,15),cex.lab=0.7,cex.axis=0.6)
>
>
axis(3,at=zzLab,labels=as.character(zzLab),col="red",col.axis="red",fon
> t.axis=1,xpd=TRUE,
> cex.lab=1,cex.axis=0.8)
>
>
> # cords <-locator(n=3)
>
>
>
>
>
>
> e tutti i telefonini TIM!
> Vai su