[R] help function axis

William Dunlap wdunlap at tibco.com
Wed Aug 15 23:31:35 CEST 2012


axis(), like many of R's add-to-a-plot functions, does
not warn if you ask then to add things whose positions
are out of the bounds of the current plot.

> plot(1:10,101:110)
> axis(side=3, at=11:12, lab=c("Eleven", "Twelve")) # all out of bounds
> axis(side=4, at=c(105,115), lab=c("CX", "CXV")) # second out of bounds
> lines(c(0,1),c(0,1)) # line is completely out of bounds

Use par("usr") or draw the default axes (omit axes=FALSE in plot())
to see what the current bounds are.

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com


> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf
> Of John Kane
> Sent: Wednesday, August 15, 2012 1:05 PM
> To: aprendiz programa; r-help at r-project.org
> Subject: Re: [R] help function axis
> 
> Well, first thing wrong is no data.  See ?dput as a way to supply sample data
> 
> Other than that everything seems okay or at least
> x<-1:6
> plot(x,type="o",axes=FALSE,xlab="year",ylab="cases")
> axis(1,at=1:6, lab=c("2000","2001","2002","2003","2004","2005"))
> axis(2,0:9)
>  plots for me.
> 
> 
> 
> John Kane
> Kingston ON Canada
> 
> 
> > -----Original Message-----
> > From: aprendizprogram at hotmail.com
> > Sent: Wed, 15 Aug 2012 21:59:13 +0300
> > To: r-help at r-project.org
> > Subject: [R] help function axis
> >
> >
> >
> > Hello,
> > I'm trying plot a graph,  but the x-axis is not appearing.What am I doing
> > wrong?
> > xx
> > 2000 42001 72002 82003 92004 22005 1
> > x<-read.table("xx.txt", header=FALSE)
> > plot(x,type="o",axes=FALSE,xlab="year",ylab="cases")
> > axis(1,at=1:6, lab=c("2000","2001","2002","2003","2004","2005"))
> > axis(2,0:9)
> > Help me!
> >
> >
> > 	[[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 MARINE AQUARIUM SCREENSAVER - Watch dolphins, sharks & orcas on your
> desktop!
> 
> ______________________________________________
> 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.



More information about the R-help mailing list