x <- rnorm(1000)
> y <- rnorm(1000)
> plot(x,y)
> axis(1,-4,4)
(speculation that attempting above ... not what you want to do...)
rather do

> plot(x,y,xlim = c(-4,4))


Rishi Ganti wrote:
Thanks, but even with axis() I can't get the x-axis to extend to the sides.

Try, e.g.,

x = rnorm(1000)

you should have some values in excess of 3 (or below -3).

I want to draw the x-axis from -4 to 4, thus encapsulating all points.

axis(1,-4:4)

but it won't draw. It TRIES to draw it, but I don't see a -4 or 4 on the plot.


----- Original Message ----- From: Thomas Lumley Sent: 6/17/2004 9:53:33 AM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: [R] disappointed with x-axes in hist and density plots


On Thu, 17 Jun 2004, Rishi Ganti wrote:


I've got a few issues with the x-axes in the histogram and density plots.  First,
often the default x-axis doesn't even extend to the length of my data. R often draws
histogram bars  (or density lines) farther than the drawn x-axis extends. For example,
I might have a histogram bar at -15,000. But I wouldn't know that, because the most
negative number on the x-axis is -10,000.  The second issue is the use of scientific
notation. Yes I can read it, but I don't prefer it. Is there any way for R just
to print out 1000000 and not 1e+6 on these charts?  Thanks for your help.  Rishi


You can use the axis() function to draw axes with any set of labels you want.

-thomas


______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to