[Rd] can't plot a line

Benilton Carvalho bcarvalh at jhsph.edu
Tue Jan 23 17:07:07 CET 2007


you don't see the line b/c you're squaring both "pi" and "-pi"

compare that with

lines(c(0,0), c(-1,1)*(2*pi)^2)

b


On Jan 23, 2007, at 10:41 AM, Spencer Graves wrote:

> Consider the following:
>
>       plot(0, 0, xlim=c(-10, 10), ylim=c(-50, 50))
>       lines(c(0,0), (2*c(-pi, pi))^2)
>
>       I see no line in this plot.
>
> R version 2.4.1 (2006-12-18)
> i386-pc-mingw32
>
> locale:
> LC_COLLATE=English_United States.1252;LC_CTYPE=English_United
> States.1252;LC_MONETARY=English_United
> States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252
>
> attached base packages:
> [1] "stats"     "graphics"  "grDevices" "utils"     "datasets"   
> "methods"
> [7] "base"
>
>       My work around is the following:
>
>       pi2.2 <- (2*pi)^2
>       lines(c(0, 0), c(-pi2.2, pi2.2))
>
>       Why won't "lines(c(0,0), (2*c(-pi, pi))^2)" work for me?
>       Thanks,
>       Spencer Graves
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



More information about the R-devel mailing list