title: adjust a legend position in a barplot
body: <p>I need to adjust the legend for the following barplot in a proper position somewhere outside the plot  </p>
  
  <pre><code>COLORS=rainbow(18)
  barplot(sort(task3_result$respondents_share,decreasing = TRUE), main="Share of respondents that mentioned brand among top 3 choices ", names.arg=task3_result$brand, col = COLORS)
  legend("right", tolower(as.character(task3_result$brand)), yjust=1,col = COLORS, lty=c(1,1) )
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/LePgl.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/LePgl.png" alt="enter image description here"></a></p>