6.6 ABBA

R figure

Code
h <- 500 
w <- 500
grid.step <- 100

plot( c(0,w), c(0,h),  
     xaxs = "i",yaxs = "i",
     xaxt = "n", yaxt = "n",
     type = "n",
     xlab = "Negatives", ylab = "Positives")
     
gx <- grid.step
while (gx <= w) {
  abline(v = gx, col="gray", lty="dotted")
  gx <- gx + grid.step
}
gy <- grid.step
while (gy <= h) {
  abline(h = gy, col="gray", lty="dotted")
  gy <- gy + grid.step
}

a <- c(0,100,400,500)
b <- c(0,400,500,500)
col <- "blue"
lines( a, b, lwd=3, type="o",col=col)

text( (a[1]+a[2])/2+20, (b[1]+b[2])/2, "B\\A",col=col)

text( (a[2]+a[3])/2-20, (b[2]+b[3])/2-30, "A",col=col)

text( (a[3]+a[4])/2+20, (b[3]+b[4])/2-20, "-",col=col)

a <- c(0,300,500)
b <- c(0,500,500)
col <- "violet"
lines( a, b, lwd=3, type="o",col=col)

text( (a[1]+a[2])/2+20, (b[1]+b[2])/2, "B",col=col)

text( (a[2]+a[3])/2+20, (b[2]+b[3])/2-20, "A\\B, -",col=col)

x <- c(0,100,300,500)
y <- c(0,400,500,500)
col <- "red"
lines( x[2:3], y[2:3], lty="dotted",col=col)
text( (x[2]+x[3])/2-15, (y[2]+y[3])/2+15, "",col=col)

Python figure

Code
import matplotlib.pyplot as plt

h = 500
w = 500
grid_step = 100

fig, ax = plt.subplots()
ax.set_xlim(0, w)
(0.0, 500.0)
Code
ax.set_ylim(0, h)
(0.0, 500.0)
Code
ax.set_xlabel("Negatives")
ax.set_ylabel("Positives")

gx = grid_step
while gx <= w:
    ax.axvline(gx, color="gray", linestyle="dotted")
    gx += grid_step

gy = grid_step
while gy <= h:
    ax.axhline(gy, color="gray", linestyle="dotted")
    gy += grid_step

a = [0, 100, 400, 500]
b = [0, 400, 500, 500]
col = "blue"
ax.plot(a, b, linewidth=3, marker='o', color=col)

ax.text((a[1] + a[2])/2 + 20, (b[1] + b[2])/2, "B\\A", color=col)
ax.text((a[2] + a[3])/2 - 20, (b[2] + b[3])/2 - 30, "A", color=col)
ax.text((a[3] + 500)/2 + 20, (b[3] + 500)/2 - 20, "-", color=col)

a = [0, 300, 500]
b = [0, 500, 500]
col = "violet"
ax.plot(a, b, linewidth=3, marker='o', color=col)

ax.text((a[1] + a[2])/2 + 20, (b[1] + b[2])/2, "B", color=col)
ax.text((a[2] + 500)/2 + 20, (b[2] + 500)/2 - 20, "A\\B, -", color=col)

x = [0, 100, 300, 500]
y = [0, 400, 500, 500]
col = "red"
ax.plot(x[1:3], y[1:3], linestyle="dotted", color=col)
ax.text((x[1] + x[2])/2 - 15, (y[1] + y[2])/2 + 15, "", color=col)

plt.show()