Dear Luigi,> On Jul 9, 2020, at 8: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?Because you're plotting on a linear, not log, scale, and 0*10^11 = 0.> round(Y/1e11)[1] 0 0 0 0 1 2 6 Then try plot(log(Y) ~ X). I hope this helps, John ----------------------------- John Fox, Professor Emeritus McMaster University Hamilton, Ontario, Canada Web: http::/socserv.mcmaster.ca/jfox> > > > -- > 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-09 13:59 UTC
[R] plot shows exponential values incompatible with data
Thank you, but why it does not work in linear? With the log scale, I know it works but I am not looking for it; is there a way to force a linear scale? Regards Luigi On Thu, Jul 9, 2020 at 3:44 PM Fox, John <jfox at mcmaster.ca> wrote:> > Dear Luigi, > > > On Jul 9, 2020, at 8: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? > > Because you're plotting on a linear, not log, scale, and 0*10^11 = 0. > > > round(Y/1e11) > [1] 0 0 0 0 1 2 6 > > Then try plot(log(Y) ~ X). > > I hope this helps, > John > > ----------------------------- > John Fox, Professor Emeritus > McMaster University > Hamilton, Ontario, Canada > Web: http::/socserv.mcmaster.ca/jfox > > > > > > > > -- > > 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
Bernard Comcast
2020-Jul-09 14:25 UTC
[R] plot shows exponential values incompatible with data
Use the xlim option in the plot function? Bernard Sent from my iPhone so please excuse the spelling!"> On Jul 9, 2020, at 10:06 AM, Luigi Marongiu <marongiu.luigi at gmail.com> wrote: > > ?Thank you, > but why it does not work in linear? With the log scale, I know it > works but I am not looking for it; is there a way to force a linear > scale? > Regards > Luigi > >> On Thu, Jul 9, 2020 at 3:44 PM Fox, John <jfox at mcmaster.ca> wrote: >> >> Dear Luigi, >> >>>> On Jul 9, 2020, at 8: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? >> >> Because you're plotting on a linear, not log, scale, and 0*10^11 = 0. >> >>> round(Y/1e11) >> [1] 0 0 0 0 1 2 6 >> >> Then try plot(log(Y) ~ X). >> >> I hope this helps, >> John >> >> ----------------------------- >> John Fox, Professor Emeritus >> McMaster University >> Hamilton, Ontario, Canada >> Web: http::/socserv.mcmaster.ca/jfox >>> >>> >>> >>> -- >>> 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 > > ______________________________________________ > 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.
Rui Barradas
2020-Jul-09 15:24 UTC
[R] plot shows exponential values incompatible with data
Hello, Like this? plot(Y~X, log="y") Hope this helps, Rui Barradas ?s 14:59 de 09/07/20, Luigi Marongiu escreveu:> Thank you, > but why it does not work in linear? With the log scale, I know it > works but I am not looking for it; is there a way to force a linear > scale? > Regards > Luigi > > On Thu, Jul 9, 2020 at 3:44 PM Fox, John <jfox at mcmaster.ca> wrote: >> >> Dear Luigi, >> >>> On Jul 9, 2020, at 8: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? >> >> Because you're plotting on a linear, not log, scale, and 0*10^11 = 0. >> >>> round(Y/1e11) >> [1] 0 0 0 0 1 2 6 >> >> Then try plot(log(Y) ~ X). >> >> I hope this helps, >> John >> >> ----------------------------- >> John Fox, Professor Emeritus >> McMaster University >> Hamilton, Ontario, Canada >> Web: http::/socserv.mcmaster.ca/jfox >>> >>> >>> >>> -- >>> 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. >> > >
Dear Bernard,> On Jul 9, 2020, at 10:25 AM, Bernard Comcast <mcgarvey.bernard at comcast.net> wrote: > > Use the xlim option in the plot function?I think you mean ylim, but as you'll find out when you try it, you still (reasonably) get an evenly spaced tick mark at 0: plot(Y ~ X, ylim=c(1e9, 6e11)) The "right" thing to do with exponential values is to plot on a log scale or (as Rui reasonably suggested) use a logged axis. Best, John> > Bernard > Sent from my iPhone so please excuse the spelling!" > >> On Jul 9, 2020, at 10:06 AM, Luigi Marongiu <marongiu.luigi at gmail.com> wrote: >> >> ?Thank you, >> but why it does not work in linear? With the log scale, I know it >> works but I am not looking for it; is there a way to force a linear >> scale? >> Regards >> Luigi >> >>> On Thu, Jul 9, 2020 at 3:44 PM Fox, John <jfox at mcmaster.ca> wrote: >>> >>> Dear Luigi, >>> >>>>> On Jul 9, 2020, at 8: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? >>> >>> Because you're plotting on a linear, not log, scale, and 0*10^11 = 0. >>> >>>> round(Y/1e11) >>> [1] 0 0 0 0 1 2 6 >>> >>> Then try plot(log(Y) ~ X). >>> >>> I hope this helps, >>> John >>> >>> ----------------------------- >>> John Fox, Professor Emeritus >>> McMaster University >>> Hamilton, Ontario, Canada >>> Web: http::/socserv.mcmaster.ca/jfox >>>> >>>> >>>> >>>> -- >>>> 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 >> >> ______________________________________________ >> 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. > > ______________________________________________ > 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.