Plot legend random Forest r
<p>I run the <code>randomForest</code> algorithm in <code>R</code> and want to plot the <code>OOB Error</code> with a legend describing it. However, I cannot seem to get it right. </p>

<p>That is the way it looks:</p>

<p><a href="https://i.stack.imgur.com/93ytb.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/93ytb.png" alt="messed up plot"></a></p>

<p>Thats the code I used: </p>

<pre><code>plot(rfOutput, log = "y", type = "l")
legend("top", colnames(rfOutput$err.rate),col=1:6,cex=0.8,fill=1:6)
</code></pre>

<p>How would I specify the colors used for the lines as well as the linetype? I dont want it dashed. Furthermore, how would I add the matching legend?</p>