How to put gridlines behind boxplot in a pdf
<p>I would like to put gridlines behind my boxplot and save as a pdf. How to do this? 
I can generate the boxplot fine with lines behind but when it is exported as a pdf the lines are in front of the plot </p>

<p>Some data </p>

<pre><code>box.data &lt;- data.frame(one = runif(6,-0.2,1),two = runif(6,-0.2,1),three = runif(6,-0.2,1),four = runif(6,-0.2,1),five = runif(6,-0.2,1),six = runif(6,-0.2,1),seven = runif(6,-0.2,1),eight = runif(6,-0.2,1), nine = runif(6,-0.2,1))
</code></pre>

<p>Boxplot code</p>

<pre><code>pdf("BiasBoxPlot.pdf")
boxplot(box.data, par(cex.axis=0.5),ylim=c(-0.2,1),yaxt = "n")
axis(2, yaxp=c(-2, 1, 30),cex.axis=0.5)
abline(h=seq(-0.2,1,0.05),col="grey80", lty="dotted",lwd = 0.4)
abline(v=seq(1,9),col="grey80", lty="dotted",lwd = 0.4)
boxplot(box.data,par(cex.axis=0.5),ylim=c(-0.2,1),add = TRUE)
dev.off()
</code></pre>

<p>which looks like this
<a href="https://i.stack.imgur.com/L0Mac.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/L0Mac.png" alt="boxplot"></a></p>

<p>(though note this is a screen clipping not a pdf as I wasn't sure how to do that)</p>

<p>This seems like something straightforward but how to put the get the <code>pdf</code> part to work?</p>