2.8 Racc unbalanced right

R figure

Code
h <- 500 
w <- 500 

grid.step <- 50

plot( c(0,w), c(0,h),  
     xaxs = "i",yaxs = "i",
     xaxt = 'n', yaxt = 'n',
     type = "n",
     xlab = "False positive rate", ylab = "True positive rate")
     
x <- c(0,  50,  100,  500)
y <- c(0, 200,  300,  500)

axis(2,y,labels=c('0','tpr1','tpr2','1'))
axis(1,x,labels=c('0','fpr1','fpr2','1'))

gx <- grid.step/2
while (gx <= w) {
  abline(v = gx, col="gray", lty="dotted")
  gx <- gx + grid.step/2
}
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 = 500
grid_step = 50

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

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_xticks(x)
ax.set_xticklabels(['0', 'fpr1', 'fpr2', '1'])
ax.set_yticks(y)
ax.set_yticklabels(['0', 'tpr1', 'tpr2', '1'])

gx = grid_step / 2
while gx <= w:
    ax.axvline(x=gx, color='gray', linestyle='dotted')
    gx += grid_step / 2

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

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("False positive rate")
ax.set_ylabel("True positive rate")
plt.show()