2.2 Coverage Left

R figure

Code
h <- 50 
w <- 50 
grid.step <- 10

TP1 <- 30
FP1 <- 10
TP2 <- 20
FP2 <- 20


plot( c(0,w), c(0,h),  
     xaxs = "i",yaxs = "i",
     xaxt = 'n', yaxt = 'n',
     type = "n",
     xlab = "Negatives", ylab = "Positives")


axis(2,c(0,TP2,TP1,h),labels=c('0','TP2','TP1','Pos'))
axis(1,c(0,FP1,FP2,w),labels=c('0','FP1','FP2','Neg'))

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
}

col1 <- "blue"
points( FP1, TP1, col=col1, type="o")
text( FP1, TP1, "C1", pos=3)
abline(h=TP1, v=FP1, col=col1, lty="dotted")

col2 <- "red"
points( FP2, TP2, col=col2, type="o")
text( FP2, TP2, "C2", pos=3)
abline(h=TP2, v=FP2, col=col2, lty="dotted")

Python figure

Code
import matplotlib.pyplot as plt
import numpy as np

h = 50
w = 50
grid_step = 10

TP1 = 30
FP1 = 10
TP2 = 20
FP2 = 20

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

ax.set_yticks([0, TP2, TP1, h])
ax.set_yticklabels(['0', 'TP2', 'TP1', 'Pos'])
ax.set_xticks([0, FP1, FP2, w])
ax.set_xticklabels(['0', 'FP1', 'FP2', 'Neg'])

for gx in range(grid_step, w, grid_step):
    ax.axvline(x=gx, color="gray", linestyle="--")

for gy in range(grid_step, h, grid_step):
    ax.axhline(y=gy, color="gray", linestyle="--")


col1 = "blue"
ax.plot(FP1, TP1, 'o', color=col1)
ax.text(FP1, TP1, "C1", color=col1, verticalalignment='bottom', horizontalalignment='center')

col2 = "red"
ax.plot(FP2, TP2, 'o', color=col2)
ax.text(FP2, TP2, "C2", color=col2, verticalalignment='bottom', horizontalalignment='center')

ax.axhline(y=TP1, color=col1, linestyle="--")
ax.axvline(x=FP1, color=col1, linestyle="--")

ax.axhline(y=TP2, color=col2, linestyle="--")
ax.axvline(x=FP2, color=col2, linestyle="--")

plt.show()