Please see this code for a demonstration of my problem... xlim <- c(-1,5) plot(1:4, xlim=xlim) abline(v=xlim[1]) abline(v=xlim[2]) When I refer to xlim, it is not referring to the boundaries of the graphical region, it refers to the maximum and minimum xticks. My question is how can I refer to the x axis boundaries (and similarly y axis) of the graph? -- View this message in context: http://n4.nabble.com/refering-to-the-boundaries-of-a-graph-tp989790p989790.html Sent from the R help mailing list archive at Nabble.com.
Try this: par("usr") give the boundaries. abline(v = par("usr")[1], col = "red", lwd = 2) abline(v = par("usr")[2], col = "red", lwd = 2) On Mon, Dec 28, 2009 at 11:55 AM, Dean1 <web13site at yahoo.co.uk> wrote:> > Please see this code for a demonstration of my problem... > > xlim <- c(-1,5) > plot(1:4, xlim=xlim) > abline(v=xlim[1]) > abline(v=xlim[2]) > > When I refer to xlim, it is not referring to the boundaries of the graphical > region, it refers to the maximum and minimum xticks. ?My question is how can > I refer to the x axis boundaries (and similarly y axis) of the graph? > -- > View this message in context: http://n4.nabble.com/refering-to-the-boundaries-of-a-graph-tp989790p989790.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > 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. >-- Henrique Dallazuanna Curitiba-Paran?-Brasil 25? 25' 40" S 49? 16' 22" O
I think what you are encountering is a standard R default. R, by default, adds 4% to the axes. I suspect that this is to avoid graphing points right on the x or x axis and thus obscuring them. Have a look at ?par xaxs for more information and how to change the default. --- On Mon, 12/28/09, Dean1 <web13site at yahoo.co.uk> wrote:> From: Dean1 <web13site at yahoo.co.uk> > Subject: [R] refering to the 'boundaries' of a graph > To: r-help at r-project.org > Received: Monday, December 28, 2009, 8:55 AM > > Please see this code for a demonstration of my problem... > > xlim <- c(-1,5) > plot(1:4, xlim=xlim) > abline(v=xlim[1]) > abline(v=xlim[2]) > > When I refer to xlim, it is not referring to the boundaries > of the graphical > region, it refers to the maximum and minimum xticks.? > My question is how can > I refer to the x axis boundaries (and similarly y axis) of > the graph? > -- > View this message in context: http://n4.nabble.com/refering-to-the-boundaries-of-a-graph-tp989790p989790.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > 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. >__________________________________________________________________ Looking for the perfect gift? Give the gift of Flickr! http://www.flickr.com/gift/