[R] Stretch the x-axis for better alignment comparison
Jim Lemon
jim at bitwrit.com.au
Thu Sep 24 12:11:10 CEST 2009
On 09/24/2009 04:25 AM, Maggie wrote:
> I have the following code that aligns the two graphs.
> Problem is that in .pdf it gives me it x-axis (0-100) is broken down
> into 0-20, 20-40..and so on.
> I wonder if there is for it to display the x-axis (and y-axis) in more
> detail than that.
> I'd appreciate your input --
>
> pdf(file="VECTOR& ICA ALIGNMENT.pdf", height=5, width=5)
> par(oma=c(4,4,4,4),mar=c(2,2,2,2),mgp=c(1.8,0.1.8,0),mfrow=c(1,1))
>
> vector<- read.table(file=paste("a_i_u_100.TXT",sep=""))
> plot(test$V2,test$V1,xlim=c(1,100),ylim=c
> (-1,10),xlab="TRs",ylab="amplitude",col="blue",type="l")
> ica<- read.table(file=paste("ica_100.TXT",sep=""))
> lines(test$V2,test$V1, col="red")
> title ("VECTOR& ICA ALIGNMENT")
>
> dev.off()
>
Hi Maggie,
The axis function defaults to fairly spaced-out labels, and will omit
labels if they are too crowded. You can get around that by specifying
that the x-axis (xaxt="n") or y-axis(yaxt="n") are not drawn by plot and
then adding one or both later. If you have the crowded axis problem,
have a look at the staxlab function in the plotrix package.
Jim
More information about the R-help
mailing list