[R] plot vs curve

Duncan Murdoch murdoch at stats.uwo.ca
Wed Sep 12 12:28:07 CEST 2007


Christian Ritz wrote:
> Dear list members,
>
> is it intentional that:
>
>
> curve(cos, xlim = c(-5, 5))
> plot(cos, xlim = c(-5, 5))
>
>
> produce different plots?
>
> Shouldn't the 'xlim' argument in both cases set the 'from' and 'to' argument if they 
> aren't supplied (at least that's what I understood reading the help page for 'curve' and 
> 'plot.function')?
>   

Yes, that's a bug in plot().  It sets the default for from and to before 
it checks whether xlim was supplied.  I'll fix it.

Duncan Murdoch
>
> Christian
>
>
>
>
>  > sessionInfo()
> R version 2.5.1 (2007-06-27)
> i386-pc-mingw32
>
> locale:
> LC_COLLATE=Danish_Denmark.1252;LC_CTYPE=Danish_Denmark.1252;LC_MONETARY=Danish_Denmark.1252;LC_NUMERIC=C;LC_TIME=Danish_Denmark.1252
>
> attached base packages:
> [1] "stats"     "graphics"  "grDevices" "utils"     "datasets"  "methods"
> [7] "base"
>
> other attached packages:
>        car       drc   plotrix      nlme      MASS   lattice
>    "1.2-1"   "1.2-3"   "2.2-4"  "3.1-83"  "7.2-34" "0.15-11"
>
> ______________________________________________
> R-help at r-project.org mailing list
> 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