Usually the par("usr") command can tell you the extremes of the current plotting region. But it's a bit difficult here because the alluvial function adjusts the mar graphics parameter within the function. It changes the margins to c(2,1,1,1). At the end of the function it reverts the margins back to what they were initially. The default margins are c(5, 4, 4, 2) + 0.1 representing the number of lines (1 line = 1/5 inches) between the bottom, left, top, and right outer margins to the plotting region. Look at help page for par and scroll down until you get to mai to see a good diagram. Another adjustment made by the alluvial function is to change the default style of the axes from regular (xaxs="r", yaxs="r") to internal (xaxs="i", yaxs="i"), which causes the axes to extend a little further.
For example:
alluvial( tit2d, freq=tit2d$Freq, xw=0.0, alpha=0.8,
gap.width=0.1, col= "steelblue", border="white",
layer = tit2d$Survived != "Yes", blocks = F )
u <- par("usr"); u
par(new=TRUE)
plot(0, type= "n", xlab = "", ylab = "", las=1, xaxs = "i", yaxs = "i",
xlim=c(u[1], u[2]), ylim=c(u[3], u[4]))
rect(u[1], u[3], u[2], u[4], col = "red")
You'll get a red rectangle filling in most of the plot region. The large gaps between the rectangle extremes and the the alluvial extremes is due to the said change in the margins.
You can try to imitate the alluvial function by manually reducing the margins as follows:
op <- par(mar=c(2,1,1,1))
par(new=TRUE)
plot(0, type= "n", xlab = "", ylab = "", las=1,
xlim=c(u[1], u[2]), ylim=c(u[3], u[4]))
rect(u[1], u[3], u[2], u[4], col = "green")
par(op)
Your green rectangle should now cover the whole alluvial plot.
Edit:
To highlight the lower rectangles:
par(new=TRUE, mar=c(2,1,1,1))
u <- par("usr")
rect(u[1], temp$endpoints[[1]][1,1], u[1]+0.2, # Note: cw has a default value of 0.1
temp$endpoints[[1]][1,2], col = "red")
rect(u[1]+1, temp$endpoints[[1]][1,1], u[1]+1.2,
temp$endpoints[[1]][1,2], col = "red")
rect(u[1]+2, temp$endpoints[[1]][1,1], u[1]+2.2,
temp$endpoints[[1]][1,2], col = "red")
Edit: Thanks to @Darren Tsai for pointing out that low-level plotting functions such as rect() do not have a "xaxs" argument for modifying the axis style, since the axes are already there!