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 [[alternative HTML version deleted]]
Thomas Lumley
2004-Jun-17 16:53 UTC
[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
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: rishi at post.harvard.edu Cc: r-help at stat.math.ethz.ch 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
You haven't read ?axis, I guess. Try using the at= argument. Whatever you do not like about the default output, chances are you can customize it to your heart's content... Andy> From: Rishi Ganti > > 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: rishi at post.harvard.edu > Cc: r-help at stat.math.ethz.ch > 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 > > ______________________________________________ > R-help at stat.math.ethz.ch 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 > >