On Thu, 17 Jun 2004 10:28:57 -0700 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.
Well you need to make enough space before! When you have got R> x <- rnorm(1000) R> y <- rnorm(1000) you need to make sure that the desired range is covered by the plot: R> plot(x, y, axes = FALSE, xlim = c(-4, 4)) then you add the x-axis R> axis(1, at = -4:4) and y-axis and a box. R> axis(2) R> box() Consult the manuals and ?plot, ?par for more information. hth, Z > > ----- 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