I'm trying to make a stacked barplot but the legends either overlap the bars, thus making it impossible to see them, or become incomplete when I use args.legend() to move them to the right:
barplot(data, legend=rownames(data), las=1) produces legends that overlap with the bars; while
barplot(data, legend=rownames(data),args.legend=list(x=3.8, bty="L"), las=1) moves the legends to the right, fixing the overlapping problem, but causing part of the legends to go outside the canvas, thus dissappearing.
I obtained datadata with tapply() and it looks like this:
*I'm using Rstudio in a Mac.

 
    