[R] axTicks and window resizing

From: Patrick Giraudoux <patrick.giraudoux_at_univ-fcomte.fr>
Date: Fri 19 Aug 2005 - 00:21:07 EST


Dear listers,

I have written a function to facilitate the drawing of altitude profiles with x (distance), y (altitude) and a z parameter (altitude magnification).

profplot<-function(x,y,z=10,...){
op <- par()$mai
par(mai=c(0.95625,0.76875,0.76875,0.95625))

plot(x,y*z, type="l",asp=1,las=1,xlab="",ylab="",yaxt="n",...)
axis(2,labels=axTicks(2)/z,las=1)
axis(4,labels=axTicks(2)/z,las=1)

on.exit(par(mai=op))
}

This worked apparently well until I had to resize the graphical window after plotting. In this case, I get this message:

> profplot(prof$dist,prof$alt,col="blue")
> Erreur : les longueurs de 'at' et de 'label' diffèrent, 7 != 8

Which means Error: length of 'at' and "label' differ, 7!=8 (whish R 2.1.1 could be parametrise 'English' even with a French Windows XP!!!!)

At this stage, R crashes (= I cannot get the graphic window working/resized and must interrupt the process from Windows XP, then restart R for good work with the graphical window).

The error occur with the difference between the tick number computed from plot() and the one computed with axTicks(). If still equal (slight resizing) everything goes smoothly.

Thanks for any comments, even rude... (I am not sure the problem/programme has been tackled relevantly enough)

Patrick



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Fri Aug 19 00:41:57 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:39:53 EST