from matplotlib.pyplot import plot, show, grid, axhline, axvline, ylim
from numpy import linspace

x = linspace(-3, 3, 100)
y = 1/x
plot(x, y)
grid()

x = linspace(-0.5, 0.5, 100)
y = 1/x
plot(x, y, color='red')

# Limiter l'affichage des y entre -5 et 5
ylim(-5, 5)

axhline(y=0, color='black', linestyle='-')
axvline(x=0, color='black', linestyle='-')
show()
