When placing the legend at "topleft", the characters appear, but the colors do not, what is a solution?
<p>I have created stand alone code that should illuminate the problem that I am having. I have looked at a number of similar questions on here, but I have had difficulty finding a solution that will work for my situation. </p>

<p>Here is example code:</p>

<pre><code>false_matrix &lt;- matrix(nrow =5,ncol=1)
false_matrix[,1]&lt;-c(5,10,15,20,25)
rownames(false_matrix)&lt;-c(2006,2007,2008,2009,2010)
barplot(false_matrix, col = c(terrain.colors(5)),
        beside=TRUE,legend=c(rownames(false_matrix))) 

legend("topleft",col=c(terrain.colors(5)),legend=c(rownames(false_matrix)))
</code></pre>

<p>That graph has two legends, one from legend = , and one from legend(). Ideally, the legend from the first call would be placed where the second one is. I cannot figure out why the colors are not showing up when i move the legend to "topleft"</p>

<p>The solution should avoid using locator(), because it is going to be used in a Shiny app. </p>