title: Legend with color filling and shading lines in Base R
body: <p>In my plot I have two intersecting polygons, one colored and one with shading lines. 
  In the legend I would like the two polygons and the intersection array represented correctly. 
  Here is what I have:</p>
  
  <pre><code>plot(1:4, 1:4, type="n", xaxt="n", xlab="", yaxt="n", ylab="")
  polygon(c(2,4,2), c(1,3,3), col="gray")
  polygon(c(3,3,1), c(1,3,2), col="red", density=10)
  legend("topleft", legend=c("A", "B", "AB"), fill=c("gray", "red", "gray"),
             density=c(NA, 10, NA), bty="n") 
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/XATDE.png" alt="Intersecting polygons, legend problem"></p>
  
  <p>Is it possible to change the border color in the legend for B to red and add red shading lines to the symbol for AB?</p>