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

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

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

ax = gca()

ax.set_xlim(left=-3, right=3)
ax.set_ylim(bottom=-5, top=5)
ax.plot((1), (0), ls="", marker=">", ms=10, color="k", transform=ax.get_yaxis_transform(), clip_on=False)
ax.plot((0), (1), ls="", marker="^", ms=10, color="k", transform=ax.get_xaxis_transform(), clip_on=False)

show()
