I have a large dataset and I am trying to create a stacked bar chart that contains countries and years. Here is what I have right now:
counts <- table(IMDB$country, IMDB$year)
barplot(counts, main="Movies produced in each country by year",
xlab="Years", col=colorRampPalette(brewer.pal(name="Dark2", n = 8))(15),
legend = rownames(counts))
How can I make all the countries visible in the legend because in my case not all of them appear, moreover, the colours look too similar so I can't distinguish sometimes between them?