Dear all, I am making a function for creating plots and part of this function is to change the labels to x axis that instead of number contains percentage number. I want to change the x axis to depict the percentage value of the presented data x<-c(501:600) y<-c(201:300) plot(x,y,axes=F) axis(2,labels=T) text=round(seq(0,100,length.out=5),2) # make percentage bar at=round(seq(min(x),max(x),length.out=5),2) axis(1,at=at,labels=F) mtext(text=text,side=1,line=1,at=at) as you will see this is different from plot(x,y) 1. the x and y axis do not meet at their beginning , there is this small gap 2. there is no box border plotted compared to plot(x,y) what I need to change to my code to make this happen? Regards Alex [[alternative HTML version deleted]]
box() at end of code John Kane Kingston ON Canada> -----Original Message----- > From: alaios at yahoo.com > Sent: Wed, 6 Jun 2012 00:40:53 -0700 (PDT) > To: r-help at r-project.org > Subject: [R] changing axis labels > > Dear all, > I am making a function for creating plots and part of this function is to > change the labels to x axis that instead of number contains percentage > number. I want to change the x axis to depict the percentage value of the > presented data > > > x<-c(501:600) > y<-c(201:300) > plot(x,y,axes=F) > axis(2,labels=T) > > text=round(seq(0,100,length.out=5),2) # make percentage bar > at=round(seq(min(x),max(x),length.out=5),2) > axis(1,at=at,labels=F) > mtext(text=text,side=1,line=1,at=at) > > > > as you will see this is different from plot(x,y) > 1. the x and y axis do not meet at their beginning , there is this small > gap > 2. there is no box border plotted compared to plot(x,y) > > what I need to change to my code to make this happen? > > Regards > Alex > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at 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.____________________________________________________________ FREE 3D EARTH SCREENSAVER - Watch the Earth right on your desktop!
Great :) ________________________________ To: R help <R-help@r-project.org> Sent: Wednesday, June 6, 2012 9:40 AM Subject: changing axis labels Dear all, I am making a function for creating plots and part of this function is to change the labels to x axis that instead of number contains percentage number. I want to change the x axis to depict the percentage value of the presented data x<-c(501:600) y<-c(201:300) plot(x,y,axes=F) axis(2,labels=T) text=round(seq(0,100,length.out=5),2) # make percentage bar at=round(seq(min(x),max(x),length.out=5),2) axis(1,at=at,labels=F) mtext(text=text,side=1,line=1,at=at) as you will see this is different from plot(x,y) 1. the x and y axis do not meet at their beginning , there is this small gap 2. there is no box border plotted compared to plot(x,y) what I need to change to my code to make this happen? Regards Alex [[alternative HTML version deleted]]