1.3 Adding shading and a grid

library(car)
Data <- carData::Burt

plot(Data$IQbio, Data$IQfoster, las = 1)
grid(lty = "solid")

abline(h = 100, col = "red")
abline(v = 100, col = "red")

i <- Data$IQbio > 100 &  Data$IQfoster > 100

points(Data$IQbio[i], Data$IQfoster[i], col = "red", pch = 16)
rect(100, 100, 140, 140, col = "#FF000020", border = NA)

library(scales)

x1 <- rnorm(1000)
y1 <- rnorm(1000)

par(oma = c(0,0,1,3))
m <- matrix(c(1,2), ncol = 1)
layout(m, height = c(1,5))

par(mar = c(0,4,0,0))
hist(x1, 
     xaxt = "n",
     yaxt = "n", 
     main = "",
     ylab = "", 
     xlab = "",
     col = alpha('blue',0.6),
     breaks = 100,
     border = 'white')

par(mar = c(4,4,0,0))
plot(x1, y1, 
     xlab = "", 
     ylab = "", 
     las = 1, 
     pch = 16,
     cex = 0.75,
     col = alpha('blue',0.5))