Luigi Marongiu
2020-Jul-09 12:59 UTC
[R] plot shows exponential values incompatible with data
Hello, I have these vectors: ``` X <- 1:7 Y <- c(1438443863, 3910100650, 10628760108, 28891979048, 78536576706, 213484643920, 580311678200) plot(Y~X) ``` The y-axis starts at 0e0, but the first value is 1.4 billion. Why the axis does not start at 1e9? -- Best regards, Luigi
Bert Gunter
2020-Jul-09 14:22 UTC
[R] plot shows exponential values incompatible with data
Please consult ?axis and follow its links (e.g. "axTicks" and "pretty") for the details of the algorithm used to construct axis annotation. Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Thu, Jul 9, 2020 at 5:59 AM Luigi Marongiu <marongiu.luigi at gmail.com> wrote:> Hello, > I have these vectors: > ``` > X <- 1:7 > Y <- c(1438443863, 3910100650, 10628760108, 28891979048, 78536576706, > 213484643920, 580311678200) > plot(Y~X) > ``` > The y-axis starts at 0e0, but the first value is 1.4 billion. Why the > axis does not start at 1e9? > > > > -- > Best regards, > Luigi > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >[[alternative HTML version deleted]]
Hi Luigi, This is a result of the "pretty" function that calculates hopefully good looking axis ticks automatically. You can always specify ylim=c(1.0E09,max(Y)) if you want. Jim On Thu, Jul 9, 2020 at 10:59 PM Luigi Marongiu <marongiu.luigi at gmail.com> wrote:> > Hello, > I have these vectors: > ``` > X <- 1:7 > Y <- c(1438443863, 3910100650, 10628760108, 28891979048, 78536576706, > 213484643920, 580311678200) > plot(Y~X) > ``` > The y-axis starts at 0e0, but the first value is 1.4 billion. Why the > axis does not start at 1e9? > > > > -- > Best regards, > Luigi > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.
Luigi Marongiu
2020-Jul-10 06:59 UTC
[R] plot shows exponential values incompatible with data
Thank you! I reckon the main problem is the large data range, anyway. I should stick with logarithmic scales... Best regards Luigi On Fri, Jul 10, 2020 at 6:14 AM Jim Lemon <drjimlemon at gmail.com> wrote:> > Hi Luigi, > This is a result of the "pretty" function that calculates hopefully > good looking axis ticks automatically. You can always specify > ylim=c(1.0E09,max(Y)) if you want. > > Jim > > On Thu, Jul 9, 2020 at 10:59 PM Luigi Marongiu <marongiu.luigi at gmail.com> wrote: > > > > Hello, > > I have these vectors: > > ``` > > X <- 1:7 > > Y <- c(1438443863, 3910100650, 10628760108, 28891979048, 78536576706, > > 213484643920, 580311678200) > > plot(Y~X) > > ``` > > The y-axis starts at 0e0, but the first value is 1.4 billion. Why the > > axis does not start at 1e9? > > > > > > > > -- > > Best regards, > > Luigi > > > > ______________________________________________ > > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > > https://stat.ethz.ch/mailman/listinfo/r-help > > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > > and provide commented, minimal, self-contained, reproducible code.-- Best regards, Luigi