plot shows exponential values incompatible with data

11 messages
Open this post in threaded view
|

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 ______________________________________________ [hidden email] mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code.
Open this post in threaded view
|

Re: plot shows exponential values incompatible with data

 Dear Luigi, > On Jul 9, 2020, at 8:59 AM, Luigi Marongiu <[hidden email]> 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 > > ______________________________________________ > [hidden email] 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. ______________________________________________ [hidden email] mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code.
Open this post in threaded view
|

Re: 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 <[hidden email]> wrote: > > Dear Luigi, > > > On Jul 9, 2020, at 8:59 AM, Luigi Marongiu <[hidden email]> 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 > > > > ______________________________________________ > > [hidden email] 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 ______________________________________________ [hidden email] mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code.
Open this post in threaded view
|

Re: plot shows exponential values incompatible with data

 In reply to this post by Fox, John Dear Luigi, > On Jul 9, 2020, at 9:59 AM, Luigi Marongiu <[hidden email]> 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? The scale *is* linear and the choice of tick marks, which are evenly spaced, is reasonable, given that 10^9 is 2 orders of magnitude smaller than 10^11. That is, on a linear scale with this range, 10^9 isn't much larger than 0. If you really want a tick at 10^9, then you can just put one there: plot(Y~X, axes=FALSE, frame=TRUE) axis(1) axis(2, at=c(1e9, (1:6)*1e11)) But now the ticks aren't evenly spaced (though they appear to be because, as I mentioned, 10^9 is "close" to 0). Best,  John > Regards > Luigi > > On Thu, Jul 9, 2020 at 3:44 PM Fox, John <[hidden email]> wrote: >> >> Dear Luigi, >> >>> On Jul 9, 2020, at 8:59 AM, Luigi Marongiu <[hidden email]> 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 >>> >>> ______________________________________________ >>> [hidden email] 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 > > ______________________________________________ > [hidden email] 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. ______________________________________________ [hidden email] mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code.
Open this post in threaded view
|

Re: plot shows exponential values incompatible with data

 In reply to this post by Luigi 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 <[hidden email]> 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 > > ______________________________________________ > [hidden email] 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]] ______________________________________________ [hidden email] mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code.
Open this post in threaded view
|

Re: plot shows exponential values incompatible with data

 In reply to this post by Luigi 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 <[hidden email]> 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 <[hidden email]> wrote: >> >> Dear Luigi, >> >>>> On Jul 9, 2020, at 8:59 AM, Luigi Marongiu <[hidden email]> 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 >>> >>> ______________________________________________ >>> [hidden email] 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 > > ______________________________________________ > [hidden email] 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. ______________________________________________ [hidden email] mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code.
Open this post in threaded view
|

Re: plot shows exponential values incompatible with data

 In reply to this post by Luigi 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 <[hidden email]> wrote: >> >> Dear Luigi, >> >>> On Jul 9, 2020, at 8:59 AM, Luigi Marongiu <[hidden email]> 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 >>> >>> ______________________________________________ >>> [hidden email] 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. >> > > ______________________________________________ [hidden email] mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code.
Open this post in threaded view
|

Re: plot shows exponential values incompatible with data

Open this post in threaded view
|

Re: plot shows exponential values incompatible with data

 In reply to this post by Luigi 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 <[hidden email]> 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 > > ______________________________________________ > [hidden email] 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. ______________________________________________ [hidden email] mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code.
Open this post in threaded view
|

Re: 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 <[hidden email]> 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 <[hidden email]> 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 > > > > ______________________________________________ > > [hidden email] 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 ______________________________________________ [hidden email] mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code.
Open this post in threaded view
|

Re: plot shows exponential values incompatible with data

 In reply to this post by Luigi Dear Jim, As I pointed out yesterday, setting ylim as you suggest still results in "0e+00" as the smallest tick mark, as it should for evenly spaced ticks. Best,  John > On Jul 10, 2020, at 12:13 AM, Jim Lemon <[hidden email]> 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 <[hidden email]> 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 >> >> ______________________________________________ >> [hidden email] 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. > > ______________________________________________ > [hidden email] 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. ______________________________________________ [hidden email] mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code.