79354470

Date: 2025-01-14 09:17:50
Score: 0.5
Natty:
Report link

Calling fig.canvas.toolbar.push_current() before xlim() is key to doing this:

import matplotlib.pyplot as plt
import numpy as np

fig,ax=plt.subplots()
t = np.linspace(-10,10,1_000)
ax.plot(t,np.sinc(t))
ax.axhline(0,linestyle=':',linewidth=0.4)
fig.canvas.toolbar.push_current()
ax.set_xlim(-2,+2)
plt.show()
Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: philn