All, Very basic question I can't seem to find the answer to: plot(0:10, 0:10) The axes intersection is not aligned at (0,0) in the lower left. How does one force this? I searched for graphical parameters under par(graphics) but can't seem to find it. Thanks! David
Pars xaxs, yaxs which take value "i": see also 'An Introduction to R. On Tue, 20 May 2008, David Afshartous wrote:> > All, > > Very basic question I can't seem to find the answer to: > > plot(0:10, 0:10) > > The axes intersection is not aligned at (0,0) in the lower left. > How does one force this? > > I searched for graphical parameters under par(graphics) but can't seem to > find it. > > Thanks! > David > > ______________________________________________ > 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. >-- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
You need to read the docs more carefully! xaxs and yaxs are the par values you want: set them to "i" . Cheers, Bert Gunter Genentech Nonclinical Statistics -----Original Message----- From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of David Afshartous Sent: Tuesday, May 20, 2008 8:50 AM To: r-help at r-project.org Subject: [R] Alignment of axes intersection All, Very basic question I can't seem to find the answer to: plot(0:10, 0:10) The axes intersection is not aligned at (0,0) in the lower left. How does one force this? I searched for graphical parameters under par(graphics) but can't seem to find it. Thanks! David ______________________________________________ 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.
On May 20, 2008, at 11:49 AM, David Afshartous wrote:> All, > > Very basic question I can't seem to find the answer to: > > plot(0:10, 0:10) > > The axes intersection is not aligned at (0,0) in the lower left.This is on purpose, so that data points are not obscured by the axes. The axis range is always selected as a bit bigger than the value range. Perhaps this does what you want: plot(0:10, 0:10, xaxs="i", yaxs="i") If it doesn't then we probably need more info.> How does one force this? > > I searched for graphical parameters under par(graphics) but can't > seem to > find it. > > Thanks! > DavidHaris Skiadas Department of Mathematics and Computer Science Hanover College
Mathematicians like to have axes cross at 0, the general rule for statistics is to have the axes positioned so that they help you understand the data, but don't interfere with the actual points (or force too much whitespace by being put to far away from the data), so the default positioning follows that idea. If you really want the axes to cross at 0 you can do:> plot(0:10, 0:10, axes=FALSE) > axis(1, pos=0) > axis(2, pos=0)-- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.snow at imail.org (801) 408-8111> -----Original Message----- > From: r-help-bounces at r-project.org > [mailto:r-help-bounces at r-project.org] On Behalf Of David Afshartous > Sent: Tuesday, May 20, 2008 9:50 AM > To: r-help at r-project.org > Subject: [R] Alignment of axes intersection > > > All, > > Very basic question I can't seem to find the answer to: > > plot(0:10, 0:10) > > The axes intersection is not aligned at (0,0) in the lower left. > How does one force this? > > I searched for graphical parameters under par(graphics) but > can't seem to find it. > > Thanks! > David > > ______________________________________________ > 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. >
On 5/20/2008 11:49 AM, David Afshartous wrote:> All, > > Very basic question I can't seem to find the answer to: > > plot(0:10, 0:10) > > The axes intersection is not aligned at (0,0) in the lower left. > How does one force this?See the xaxs and yaxs parameters in help("par"), for example plot(0:10, 0:10, xaxs="i", yaxs="i") does what you ask. It's also clear from that plot why this is not the default: two of the points are nearly invisible. Duncan Murdoch> > I searched for graphical parameters under par(graphics) but can't seem to > find it. > > Thanks! > David > > ______________________________________________ > 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.