pearselab / r-intro-sylviakinosian

r-intro-sylviakinosian created by GitHub Classroom
0 stars 1 forks source link

lesson 3 #4

Open sylviakinosian opened 8 years ago

sylviakinosian commented 8 years ago

Hi Will,

I've come back to the polygon question in lesson 3 and I cannot remember what you explained to me this morning... something about a loop and plotting all the lines on the same graph? I've tried using the plot.line instead of new.line, but now when I try to change the x & y limits or something it won't let me. I'm just very confused, and probably over thinking it.

Also, there is a polygon function already in R... is that of any use here?

Thanks, Sylvia

willpearse commented 8 years ago

come to https://appear.in/usubioprogramming

willpearse commented 8 years ago

Something like:

my_func <- function(x, first=TRUE, ...){
   if(first)
      plot(some.plotting.code, type="n")
   points(some.plotting.code) #...or lines, or ....
}
my_func(first.point)
my_func(second.point, FALSE)

...should do the trick...