2.8 Racc unbalanced left

R figure

Code
h <- 500 
w <- 1000 
grid.step <- 50

plot( c(0,w), c(0,h),  
     xaxs = "i",yaxs = "i",
     xaxt = 'n', yaxt = 'n',
     type = "n",
     xlab = "Negatives", ylab = "Positives")
     
x <- c(0, 100,  200, 1000)
y <- c(0, 200,  300,  500)

axis(2,y,labels=c('0','TP1','TP2','Pos'))
axis(1,x,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
}

for (i in 2:3) {
  abline(v=x[i],lty='dashed')
  abline(h=y[i],lty='dashed')
}

lines( x, y, lty=1, type='o')

Python figure

Code
import matplotlib.pyplot as plt
import numpy as np

h = 500
w = 1000
grid_step = 50

x = [0, 100, 200, 1000]
y = [0, 200, 300, 500]

fig, ax = plt.subplots()
ax.set_xlim(0, w)
(0.0, 1000.0)
Code
ax.set_ylim(0, h)
(0.0, 500.0)
Code
ax.set_xticks(x)
ax.set_xticklabels(['0', 'FP1', 'FP2', 'Neg'])
ax.set_yticks(y)
ax.set_yticklabels(['0', 'TP1', 'TP2', 'Pos'])

for gx in range(grid_step, w + 1, grid_step):
    ax.axvline(x=gx, color='gray', linestyle='dotted')
for gy in range(grid_step, h + 1, grid_step):
    ax.axhline(y=gy, color='gray', linestyle='dotted')

for i in [1, 2]:
    ax.axvline(x=x[i], linestyle='dashed')
    ax.axhline(y=y[i], linestyle='dashed')

ax.plot(x, y, marker='o', linestyle='solid')

ax.set_xlabel("Negatives")
ax.set_ylabel("Positives")
plt.show()