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
axTicks and window resizing
6 messages · Patrick Giraudoux, Brian Ripley
On Thu, 18 Aug 2005, Patrick Giraudoux wrote:
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!!!!)
If I understand you correctly, it can. Just add LANGUAGE=en to the shortcut.
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.
The problem is that you need to specify 'at' and 'labels' to axis(): you cannot safely specify just labels. When re-drawing, 'at' is recomputed, but your specification of 'labels' is not. I suspect you can just do dev.off() and open a new graphics window.
Thanks for any comments, even rude... (I am not sure the problem/programme has been tackled relevantly enough) Patrick
______________________________________________ R-help at 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
Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
(whish R 2.1.1 could be parametrise 'English' even with a French Windows XP!!!!) If I understand you correctly, it can. Just add LANGUAGE=en to the shortcut.
Wonderful hope but not sure to catch what you term "shortcut". I tried to add this command in C:\R\rw2011\etc\Rprofile, the .Rprofile in the folder my documents, but this cannot be understood from there... which obviously shows that "shortcut" is not a general term for profiles! I have also unsuccessfully looked for a file "shortcut" in the rw2011 folder. I also tried and went through the R-help archive. There were some exchanges on this subject and Asian languages some weeks ago but what I have tried and adapt on this basis did not work. The objective would be to have R in English (thus additionnally allowing MDI mode with R-WinEdt, which is not the case with any other language) and to keep Windows XP and other applications in the foreign (= French, here) language. Thanks for any further hint, Patrick Giraudoux
OK. Things work now and the window can be resized easy after adding at =
axTicks() in axis() explicitely. This makes:
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,at=axTicks(2),labels=axTicks(2)/z,las=1)
axis(4,at=axTicks(2),labels=axTicks(2)/z,las=1)
par(mai=op)
}
Thanks for the hint,
Patrick
Prof Brian Ripley a ??crit :
On Thu, 18 Aug 2005, Patrick Giraudoux wrote:
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!!!!)
If I understand you correctly, it can. Just add LANGUAGE=en to the shortcut.
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.
The problem is that you need to specify 'at' and 'labels' to axis(): you cannot safely specify just labels. When re-drawing, 'at' is recomputed, but your specification of 'labels' is not. I suspect you can just do dev.off() and open a new graphics window.
Thanks for any comments, even rude... (I am not sure the problem/programme has been tackled relevantly enough) Patrick
______________________________________________ R-help at 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
On Thu, 18 Aug 2005, Patrick Giraudoux wrote:
(whish R 2.1.1 could be parametrise 'English' even with a French Windows XP!!!!) If I understand you correctly, it can. Just add LANGUAGE=en to the shortcut.
Wonderful hope but not sure to catch what you term "shortcut". I tried to add this command in C:\R\rw2011\etc\Rprofile, the .Rprofile in the folder my documents, but this cannot be understood from there... which obviously shows that "shortcut" is not a general term for profiles! I have also
See the rw-FAQ Q2.2. `Shortcut' is the standard name for files on Windows with extension .lnk. Another way is to add this to HOME/.Renviron: see the rw-FAQ Q2.17
unsuccessfully looked for a file "shortcut" in the rw2011 folder. I also tried and went through the R-help archive. There were some exchanges on this subject and Asian languages some weeks ago but what I have tried and adapt on this basis did not work. The objective would be to have R in English (thus additionnally allowing MDI mode with R-WinEdt, which is not the case with any other language) and to keep Windows XP and other applications in the foreign (= French, here) language. Thanks for any further hint, Patrick Giraudoux
Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
OK. ??Perfectly clear.
This written for other listers:
Shortcut is the shortcuts ("alias") everybody use to launch applications
(in French: "raccourci"), and for suckers (as I am): one just have to
right-click the shortcut used to launch Rgui.exe, select properties
("propri??t??s" in French) and add in the box target ("cible" in French)
LANGUAGE=en to the path. In my case: C:\R\rw2011\bin\Rgui.exe. Thus, it
makes C:\R\rw2011\bin\Rgui.exe LANGUAGE=en. Then click OK.
It works fantastic!!!!
Thanks a lot for this. It makes three weeks I was grumling everytime
(often) I started R, and frustrated with the SDI mode...
Patrick Giraudoux
Prof Brian Ripley a ??crit :
On Thu, 18 Aug 2005, Patrick Giraudoux wrote:
(whish R 2.1.1 could be parametrise 'English' even with a French Windows XP!!!!) If I understand you correctly, it can. Just add LANGUAGE=en to the shortcut.
Wonderful hope but not sure to catch what you term "shortcut". I tried to add this command in C:\R\rw2011\etc\Rprofile, the .Rprofile in the folder my documents, but this cannot be understood from there... which obviously shows that "shortcut" is not a general term for profiles! I have also
See the rw-FAQ Q2.2. `Shortcut' is the standard name for files on Windows with extension .lnk. Another way is to add this to HOME/.Renviron: see the rw-FAQ Q2.17
unsuccessfully looked for a file "shortcut" in the rw2011 folder. I also tried and went through the R-help archive. There were some exchanges on this subject and Asian languages some weeks ago but what I have tried and adapt on this basis did not work. The objective would be to have R in English (thus additionnally allowing MDI mode with R-WinEdt, which is not the case with any other language) and to keep Windows XP and other applications in the foreign (= French, here) language. Thanks for any further hint, Patrick Giraudoux