title: R : legend() error
body: <p>I'm trying to generate a legend for a plot to show the colors' relationships to cluster # in a plot.  I don't actually need it in the plot I just want to generate a legend then copy and paste it into a powerpoint slide.</p>
  
  <p>I found this code here that does what I want:</p>
  
  <p><a href="http://www.statmethods.net/advgraphs/axes.html" rel="nofollow">http://www.statmethods.net/advgraphs/axes.html</a></p>
  
  <pre><code># Legend Example
  attach(mtcars)
  boxplot(mpg~cyl, main="Milage by Car Weight",
      yaxt="n", xlab="Milage", horizontal=TRUE,
     col=terrain.colors(3))
  legend("topright", inset=.05, title="Number of Cylinders",
      c("4","6","8"), fill=terrain.colors(3), horiz=TRUE)
  </code></pre>
  
  <p>but am having difficulty replicating it.  Here's my code:</p>
  
  <pre><code>plot(seq(1,7), seq(1,7), col = c(1:7))
  legend("topright", inset = .05, title = "Cluster Colors"
      ,fill = c(1:7), horiz=T)
  </code></pre>
  
  <p>when I run it, I get this error:</p>
  
  <pre><code>Error in as.graphicsAnnot(legend) : 
    argument "legend" is missing, with no default
  </code></pre>
  
  <p>Any suggestions?</p>