Please, could someone help me figure out what seems to be a very simple problem (and is still taking me hours...). I want to draw a simple scatterplot but with 'equal' axes, i.e. I want both axes to go from -3 to 3. Values for x lie between -2 and 0.5, values for y between -2.2 and 3. I have tried 'usr' and 'eqscplot' and a few other options, but it doesn't give me the desired result. Many thanks!!! Ellen
> Please, could someone help me figure out what seems to be a > very simple > problem (and is still taking me hours...). > I want to draw a simple scatterplot but with 'equal' axes, > i.e. I want both > axes to go from -3 to 3. Values for x lie between -2 and 0.5, > values for yHello Ellen, how about: (x <- seq(-2, 0.5, length=10)) (y <- seq(-3, 3, length=10)) plot(y~x, xlim=c(-3,3), ylim=c(-3, 3)) HTH, Bernhard> between -2.2 and 3. I have tried 'usr' and 'eqscplot' and a few other > options, but it doesn't give me the desired result. > Many thanks!!! > Ellen > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help >-------------------------------------------------------------------------------- The information contained herein is confidential and is intended solely for the addressee. Access by any other party is unauthorised without the express written permission of the sender. If you are not the intended recipient, please contact the sender either via the company switchboard on +44 (0)20 7623 8000, or via e-mail return. If you have received this e-mail in error or wish to read our e-mail disclaimer statement and monitoring policy, please refer to http://www.drkw.com/disc/email/ or contact the sender.
Have you tried specifying xlim and ylim? See ?par. -- __________________________________________________ [ ] [ Giovanni Petris GPetris at uark.edu ] [ Department of Mathematical Sciences ] [ University of Arkansas - Fayetteville, AR 72701 ] [ Ph: (479) 575-6324, 575-8630 (fax) ] [ http://definetti.uark.edu/~gpetris/ ] [__________________________________________________]> Date: Wed, 10 Dec 2003 14:46:49 +0100 > From: Ellen Kalmbach <e.kalmbach at biol.rug.nl> > Sender: r-help-bounces at stat.math.ethz.ch > Precedence: list > > Please, could someone help me figure out what seems to be a very simple > problem (and is still taking me hours...). > I want to draw a simple scatterplot but with 'equal' axes, i.e. I want both > axes to go from -3 to 3. Values for x lie between -2 and 0.5, values for y > between -2.2 and 3. I have tried 'usr' and 'eqscplot' and a few other > options, but it doesn't give me the desired result. > Many thanks!!! > Ellen > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help > >
Ellen - plot(my.x.vector, my.y.vector, xlim=c(-3,3), ylim=c(-3,3)) It's the named arguments xlim and ylim that you were looking for. I frequently set them as xlim = 3 * c(-1,1), ylim = 3 * c(-1,1) so that I can change the range by editing just one number rather than two. For an added fillip, try adding the argument asp=1. This will extend the range of one axis or the other by just enough so that the graphical scale is the same on both axes, that is, a one unit increase is the same number of millimeters on the horizontal and the vertical axes. It's very cool. It does, completely automatically, what I used to do painstakingly by trial and error, tinkering with the width of the top and side margins, until the graphical scales were equal. - tom blackwell - u michigan medical school - ann arbor - On Wed, 10 Dec 2003, Ellen Kalmbach wrote:> Please, could someone help me figure out what seems to be a very simple > problem (and is still taking me hours...). > I want to draw a simple scatterplot but with 'equal' axes, i.e. I want both > axes to go from -3 to 3. Values for x lie between -2 and 0.5, values for y > between -2.2 and 3. I have tried 'usr' and 'eqscplot' and a few other > options, but it doesn't give me the desired result. > Many thanks!!! > Ellen > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help >
plot(y~x,xlim=range(-3,3),ylim=range(-3,3)) Best A.S. ---------------------------- Alessandro Semeria Models and Simulations Laboratory Montecatini Environmental Research Center (Edison Group), Via Ciro Menotti 48, 48023 Marina di Ravenna (RA), Italy Tel. +39 544 536811 Fax. +39 544 538663 E-mail: alessandro.semeria at cramont.it "Ellen Kalmbach" <e.kalmbach at biol.rug. To: <r-help at stat.math.ethz.ch> nl> cc: Sent by: Subject: [R] Scatterplot axes r-help-bounces at stat.m ath.ethz.ch 10-12-2003 14.46 Please, could someone help me figure out what seems to be a very simple problem (and is still taking me hours...). I want to draw a simple scatterplot but with 'equal' axes, i.e. I want both axes to go from -3 to 3. Values for x lie between -2 and 0.5, values for y between -2.2 and 3. I have tried 'usr' and 'eqscplot' and a few other options, but it doesn't give me the desired result. Many thanks!!! Ellen ______________________________________________ R-help at stat.math.ethz.ch mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help