I am creating a stacked plot using "barplot" in R. I want to set the chart area color to gray and the background to light blue. I can set the background color to light blue but cannot control the color inside the chart area. There are similar questions asked for chartjs but nothing for barplot.Below is the script I was attempting. Is there a way I can have a different color (gray) within the chart area bound by the axes and different color (light blue) outside the axes?
cols <-c("#4F81BD","#8064A2","#9BBB59","#C0504D","#000077")
pdf(file="Figure-check.pdf", width=11.5, height=8)
par(mar=c(10,3,6,7) +.01, bg = "#99CCFF")
barplot(Variabletoplot, main="Figure Title", col= cols, border = TRUE, axes = TRUE, ylab = "YLABEL", bg = "gray")
legend("right", rownames(merge1), fill=cols, horiz=FALSE, title="LEGEND TITLE", xpd=TRUE, inset =c(-.145,0))
dev.off()