Dear Forum, Assuming I need to plot a graph. In the code I have defined X axis range as xlim=c(0,18000) In the plot, the values visible w.r.t X axis are 0, 5000, 10000, 18000. To improve the graph clarity, is there any way I can show the values of X axis as 0, 1000, 2000, 3000, 4000, 5000 .......18000 i.e. the values increase by 1000 instead of 5000. Regards Amelia
Hi Amelia, The usual way is: plot(...,xaxt="n") axis(1,at=seq(0,18000,by=1000) However, you will get overlapping labels unless you use a small font or a large graphics device. You may want to look at the staxlab function in the plotrix package. Jim On Fri, Dec 18, 2015 at 10:20 PM, Amelia Marsh via R-help < r-help at r-project.org> wrote:> Dear Forum, > > Assuming I need to plot a graph. In the code I have defined X axis range as > > > > xlim=c(0,18000) > > > In the plot, the values visible w.r.t X axis are 0, 5000, 10000, 18000. > > To improve the graph clarity, is there any way I can show the values of X > axis as 0, 1000, 2000, 3000, 4000, 5000 .......18000 i.e. the values > increase by 1000 instead of 5000. > > Regards > > Amelia > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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. >[[alternative HTML version deleted]]
Dear Amelia As well as Jim's excellent advice you may want to look at the las parameter which enables you to alter the orientation. Of course you then have to lie on your side to read them or turn your monitor through pi/2 On 18/12/2015 11:30, Jim Lemon wrote:> Hi Amelia, > The usual way is: > > plot(...,xaxt="n") > axis(1,at=seq(0,18000,by=1000) > > However, you will get overlapping labels unless you use a small font or a > large graphics device. You may want to look at the staxlab function in the > plotrix package. > > Jim > > > On Fri, Dec 18, 2015 at 10:20 PM, Amelia Marsh via R-help < > r-help at r-project.org> wrote: > >> Dear Forum, >> >> Assuming I need to plot a graph. In the code I have defined X axis range as >> >> >> >> xlim=c(0,18000) >> >> >> In the plot, the values visible w.r.t X axis are 0, 5000, 10000, 18000. >> >> To improve the graph clarity, is there any way I can show the values of X >> axis as 0, 1000, 2000, 3000, 4000, 5000 .......18000 i.e. the values >> increase by 1000 instead of 5000. >> >> Regards >> >> Amelia >> >> ______________________________________________ >> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see >> 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. >> > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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. >-- Michael http://www.dewey.myzen.co.uk/home.html
Dear Sir Thanks a lot for your great help. I had tried the argument by = 1000, but wasn't aware of "seq". Thanks again. With regards Amelia On Friday, 18 December 2015 5:00 PM, Jim Lemon <drjimlemon at gmail.com> wrote: Hi Amelia,The usual way is: plot(...,xaxt="n")axis(1,at=seq(0,18000,by=1000) However, you will get overlapping labels unless you use a small font or a large graphics device. You may want to look at the staxlab function in the plotrix package. Jim On Fri, Dec 18, 2015 at 10:20 PM, Amelia Marsh via R-help <r-help at r-project.org> wrote: Dear Forum, Assuming I need to plot a graph. In the code I have defined X axis range as xlim=c(0,18000) In the plot, the values visible w.r.t X axis are 0, 5000, 10000, 18000. To improve the graph clarity, is there any way I can show the values of X axis as 0, 1000, 2000, 3000, 4000, 5000 .......18000 i.e. the values increase by 1000 instead of 5000. Regards Amelia ______________________________________________ R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see 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. [[alternative HTML version deleted]]