Hello - I'm just getting into 'R' and am having trouble setting up the x-y axis to share (0,0). In the example posted here: http://geocities.com/chris_ciotti/Images/part1.pdf, each axis has a 0 which I do not want. Any help on getting a graph starting at (0,0) would be greatly appreciated. -- chris ciotti (chris_ciotti at yahoo.com) PGP ID: 0xE94BB3B7
?par, look at xaxs and yaxs, especially style "i". On Mon, 15 Mar 2004, christopher ciotti wrote:> I'm just getting into 'R' and am having trouble setting up the x-y axis > to share (0,0). In the example posted here: > http://geocities.com/chris_ciotti/Images/part1.pdf, each axis has a 0 > which I do not want. > > Any help on getting a graph starting at (0,0) would be greatly > appreciated.-- 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
I don't understand exactly what you want but the following might help: plot(1:11, 1:11, xlim=c(2, 5), ylim=c(3, 7)) Is this what you want? spencer graves christopher ciotti wrote:> Hello - > > I'm just getting into 'R' and am having trouble setting up the x-y > axis to share (0,0). In the example posted here: > http://geocities.com/chris_ciotti/Images/part1.pdf, each axis has a 0 > which I do not want. > Any help on getting a graph starting at (0,0) would be greatly > appreciated. >
On Mon, 2004-03-15 at 08:45, christopher ciotti wrote:> Hello - > > I'm just getting into 'R' and am having trouble setting up the x-y axis > to share (0,0). In the example posted here: > http://geocities.com/chris_ciotti/Images/part1.pdf, each axis has a 0 > which I do not want. > > Any help on getting a graph starting at (0,0) would be greatly > appreciated.What you are seeing is the default behavior for axis ranges, which are extended by 4% under default circumstances. This is described in the help for 'par' under 'xaxs' when using the default axis style "r". See ?par for additional information. So for example, if you use: plot(c(0, 100), c(0,140)) You will see a generic scatter plot that has roughly the same axis ranges as your plot. You have a simple approach to alter this behavior by changing the axis styles to "i". plot(c(0, 100), c(0,140), xaxs = "i", yaxs = "i") If your x and y values do not actually contain (0,0), you can explicitly define the axis ranges by using 'xlim' and 'ylim' respectively: plot(c(1, 100), c(1,140), xaxs = "i", yaxs = "i") Note the above origin is at (1, 1). Use the following instead: plot(c(1, 100), c(1,140), xaxs = "i", yaxs = "i", xlim = c(0, 100), ylim = c(0, 140)) You can also adjust the xlim and ylim values as you require based upon you actual data (ie. xlim = c(0, max(x)) ) You might want to review ?plot.default and ?axis for additional information on some of the arguments available for fine tuning plots and axes along with the help for par. HTH, Marc Schwartz
christopher ciotti wrote:> Hello - > > I'm just getting into 'R' and am having trouble setting up the x-y > axis to share (0,0). In the example posted here: > http://geocities.com/chris_ciotti/Images/part1.pdf, each axis has a 0 > which I do not want. > Any help on getting a graph starting at (0,0) would be greatly > appreciated. >Thank you all for the info. -- chris ciotti (chris_ciotti at yahoo.com) PGP ID: 0xE94BB3B7