Re: [R] two questions about PLOT
thanks for your reply. I have tried to use rseek.org.But still some problems. When I add axis(4) and axis(1,at=1:6,labels=gradeinfo$gradenam),the old tick or labels still are there as shown in the figure,how could I delete them( the old tick information in x-axis and left y axis ) My script is shown as below : plot(avegrp,type='l',lty=1,col='black',lwd=4,xlab=xxlab,ylab=yylab,labels=TRUE) axis(2) axis(1,at=1:6,labels=gradeinfo$gradenam, tick=FALSE) par(new=T) plot(sdgrp,type='l',lty=3,col='red1',xlab=xxlab,ylab=yylab,lwd=4,labels=TRUE) axis(1,at=1:6,labels=gradeinfo$gradenam, tick=FALSE) #axis(2, col = gold, lty = 2, lwd = 0.5) axis(4) legend(topright, legend, lty=llty, lwd=llwd,col =lgcol) 2010/6/1 Jannis bt_jan...@yahoo.de I would wote this question one of the most often asked questions here on that list ;-). Try searching the help archiwe (www.rseek.org) and you will find solutions. I would guess that you need to use something like: axis(4) as the sides of the plot are always numbered from bottom,left,top,right HTH Jannis Jie TANG schrieb: here ,I want to plot two lines in one figure.But I have two problems 1) how to move one of the y-axis to be the right ? I tried to the commandaxis(2),But I failed. 2) how to add the axis information correctly.Since I have use the cmommand axis(1,at=1:6,labels=gradeinfo$gradenam) but it seems that the correct information that I want is superposition with the old axis information.What can i do ? the script and figure is shown as below .thanks .:) outflnm-paste(Outdic,meansd.jpg,sep=/) jpeg(file=outflnm, bg=transparent) legend-c(average error,stand quare error) lgcol-c(black,red1) par(las=1) yylab-c(forecast error) xxlab-c(typhoon class) llty-c(1,3) llwd-c(4,4) #par(bg='yellow') plot(avegrp,type='l',lty=1,col='black',lwd=4,xlab=xxlab,ylab=yylab) par(new=T) plot(sdgrp,type='l',lty=3,col='red1',xlab=xxlab,ylab=yylab,lwd=4) #axis(2, col = gold, lty = 2, lwd = 0.5) legend(topright, legend, lty=llty, lwd=llwd,col =lgcol) axis(1,at=1:6,labels=gradeinfo$gradenam) dev.off() __ R-help@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. -- TANG Jie Email: totang...@gmail.com Tel: 0086-2154896104 Shanghai Typhoon Institute,China __ R-help@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.
Re: [R] two questions about PLOT
It may not be the nicest solution, but my suggestion should work. Have you tried plot(type=n,...), plotting the axes with axis(), and plotting the data with lines()? Ivan Le 6/1/2010 10:10, Jie TANG a écrit : thanks for your reply. I have tried to use rseek.org.But still some problems. When I add axis(4) and axis(1,at=1:6,labels=gradeinfo$gradenam),the old tick or labels still are there as shown in the figure,how could I delete them( the old tick information in x-axis and left y axis ) My script is shown as below : plot(avegrp,type='l',lty=1,col='black',lwd=4,xlab=xxlab,ylab=yylab,labels=TRUE) axis(2) axis(1,at=1:6,labels=gradeinfo$gradenam, tick=FALSE) par(new=T) plot(sdgrp,type='l',lty=3,col='red1',xlab=xxlab,ylab=yylab,lwd=4,labels=TRUE) axis(1,at=1:6,labels=gradeinfo$gradenam, tick=FALSE) #axis(2, col = gold, lty = 2, lwd = 0.5) axis(4) legend(topright, legend, lty=llty, lwd=llwd,col =lgcol) 2010/6/1 Jannisbt_jan...@yahoo.de I would wote this question one of the most often asked questions here on that list ;-). Try searching the help archiwe (www.rseek.org) and you will find solutions. I would guess that you need to use something like: axis(4) as the sides of the plot are always numbered from bottom,left,top,right HTH Jannis Jie TANG schrieb: here ,I want to plot two lines in one figure.But I have two problems 1) how to move one of the y-axis to be the right ? I tried to the commandaxis(2),But I failed. 2) how to add the axis information correctly.Since I have use the cmommand axis(1,at=1:6,labels=gradeinfo$gradenam) but it seems that the correct information that I want is superposition with the old axis information.What can i do ? the script and figure is shown as below .thanks .:) outflnm-paste(Outdic,meansd.jpg,sep=/) jpeg(file=outflnm, bg=transparent) legend-c(average error,stand quare error) lgcol-c(black,red1) par(las=1) yylab-c(forecast error) xxlab-c(typhoon class) llty-c(1,3) llwd-c(4,4) #par(bg='yellow') plot(avegrp,type='l',lty=1,col='black',lwd=4,xlab=xxlab,ylab=yylab) par(new=T) plot(sdgrp,type='l',lty=3,col='red1',xlab=xxlab,ylab=yylab,lwd=4) #axis(2, col = gold, lty = 2, lwd = 0.5) legend(topright, legend, lty=llty, lwd=llwd,col =lgcol) axis(1,at=1:6,labels=gradeinfo$gradenam) dev.off() __ R-help@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. __ R-help@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. -- Ivan CALANDRA PhD Student University of Hamburg Biozentrum Grindel und Zoologisches Museum Abt. Säugetiere Martin-Luther-King-Platz 3 D-20146 Hamburg, GERMANY +49(0)40 42838 6231 ivan.calan...@uni-hamburg.de ** http://www.for771.uni-bonn.de http://webapp5.rrz.uni-hamburg.de/mammals/eng/mitarbeiter.php [[alternative HTML version deleted]] __ R-help@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.
Re: [R] two questions about PLOT
On 06/01/2010 12:44 AM, Jie TANG wrote: here ,I want to plot two lines in one figure.But I have two problems 1) how to move one of the y-axis to be the right ? I tried to the commandaxis(2),But I failed. 2) how to add the axis information correctly.Since I have use the cmommand axis(1,at=1:6,labels=gradeinfo$gradenam) but it seems that the correct information that I want is superposition with the old axis information.What can i do ? the script and figure is shown as below .thanks .:) outflnm-paste(Outdic,meansd.jpg,sep=/) jpeg(file=outflnm, bg=transparent) legend-c(average error,stand quare error) lgcol-c(black,red1) par(las=1) yylab-c(forecast error) xxlab-c(typhoon class) llty-c(1,3) llwd-c(4,4) #par(bg='yellow') plot(avegrp,type='l',lty=1,col='black',lwd=4,xlab=xxlab,ylab=yylab) par(new=T) plot(sdgrp,type='l',lty=3,col='red1',xlab=xxlab,ylab=yylab,lwd=4) #axis(2, col = gold, lty = 2, lwd = 0.5) legend(topright, legend, lty=llty, lwd=llwd,col =lgcol) axis(1,at=1:6,labels=gradeinfo$gradenam) dev.off() Hi Jie, First problem: # put this just after the jpeg device is opened # to leave extra space on the right par(mar=c(5,4,4,4) # then just before dev.off axis(4,...) Second problem: # don't display the default x axis plot(avegrp,type='l',lty=1,col='black',lwd=4, xlab=xxlab,ylab=yylab,xaxt=n) # then display your custom axis Jim __ R-help@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.
Re: [R] two questions about PLOT
Hi, Not sure it is the best solution, but I would create the layout of the plot part by part: plot(type=n) #does not plot axis(1, at=1:6,...) #set the x-axis at the bottom axis(4,...) #set the y-axis on the right. I'm not sure that's what you were looking for, didn't really understand it lines(avegrp,...) #plot your data And do not forget to provide sample data! HTH Ivan Le 5/31/2010 16:44, Jie TANG a écrit : here ,I want to plot two lines in one figure.But I have two problems 1) how to move one of the y-axis to be the right ? I tried to the commandaxis(2),But I failed. 2) how to add the axis information correctly.Since I have use the cmommand axis(1,at=1:6,labels=gradeinfo$gradenam) but it seems that the correct information that I want is superposition with the old axis information.What can i do ? the script and figure is shown as below .thanks .:) outflnm-paste(Outdic,meansd.jpg,sep=/) jpeg(file=outflnm, bg=transparent) legend-c(average error,stand quare error) lgcol-c(black,red1) par(las=1) yylab-c(forecast error) xxlab-c(typhoon class) llty-c(1,3) llwd-c(4,4) #par(bg='yellow') plot(avegrp,type='l',lty=1,col='black',lwd=4,xlab=xxlab,ylab=yylab) par(new=T) plot(sdgrp,type='l',lty=3,col='red1',xlab=xxlab,ylab=yylab,lwd=4) #axis(2, col = gold, lty = 2, lwd = 0.5) legend(topright, legend, lty=llty, lwd=llwd,col =lgcol) axis(1,at=1:6,labels=gradeinfo$gradenam) dev.off() __ R-help@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. -- Ivan CALANDRA PhD Student University of Hamburg Biozentrum Grindel und Zoologisches Museum Abt. Säugetiere Martin-Luther-King-Platz 3 D-20146 Hamburg, GERMANY +49(0)40 42838 6231 ivan.calan...@uni-hamburg.de ** http://www.for771.uni-bonn.de http://webapp5.rrz.uni-hamburg.de/mammals/eng/mitarbeiter.php [[alternative HTML version deleted]] __ R-help@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.
Re: [R] two questions about PLOT
I would wote this question one of the most often asked questions here on that list ;-). Try searching the help archiwe (www.rseek.org) and you will find solutions. I would guess that you need to use something like: axis(4) as the sides of the plot are always numbered from bottom,left,top,right HTH Jannis Jie TANG schrieb: here ,I want to plot two lines in one figure.But I have two problems 1) how to move one of the y-axis to be the right ? I tried to the commandaxis(2),But I failed. 2) how to add the axis information correctly.Since I have use the cmommand axis(1,at=1:6,labels=gradeinfo$gradenam) but it seems that the correct information that I want is superposition with the old axis information.What can i do ? the script and figure is shown as below .thanks .:) outflnm-paste(Outdic,meansd.jpg,sep=/) jpeg(file=outflnm, bg=transparent) legend-c(average error,stand quare error) lgcol-c(black,red1) par(las=1) yylab-c(forecast error) xxlab-c(typhoon class) llty-c(1,3) llwd-c(4,4) #par(bg='yellow') plot(avegrp,type='l',lty=1,col='black',lwd=4,xlab=xxlab,ylab=yylab) par(new=T) plot(sdgrp,type='l',lty=3,col='red1',xlab=xxlab,ylab=yylab,lwd=4) #axis(2, col = gold, lty = 2, lwd = 0.5) legend(topright, legend, lty=llty, lwd=llwd,col =lgcol) axis(1,at=1:6,labels=gradeinfo$gradenam) dev.off() __ R-help@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. __ R-help@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.