Please consider those data example:
e3 <- data.frame(400)
e3 <- rep( c("high", "medium", "low", "personal", "SPAM"), c(60, 120, 20, 50, 150))
I create a pie chart, and I placed the legend outside the margins of the chart, like straightforwardly discussed here.
par(mar=c(5.1, 4.1, 4.1, 8.1), xpd=TRUE)
pie(table(e3), labels = paste(round(prop.table(table(e3))*100), "%",
sep = ""), col = heat.colors(5), main = "Mail received - n: 400"),
legend("topright", legend = c("High", "Medium", "Low", "Personal",
"SPAM"), fill = heat.colors(5), inset=c(-1,0), title = "Categories", cex = 0.55)
The problem is that the margins around the plot are not visible. I added lwd = 2, col = "black"
to par()
, but nothing appears while I would a "black rectangle" around the chart. Most likely, my intervention is not correctly directed. Any suggestion or constructive criticism is really appreciated.