[R] plot shows exponential values incompatible with data

Fox, John j|ox @end|ng |rom mcm@@ter@c@
Thu Jul 9 15:44:50 CEST 2020


Dear Luigi,

> On Jul 9, 2020, at 8:59 AM, Luigi Marongiu <marongiu.luigi using 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 using 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.



More information about the R-help mailing list